#########################################################################################
# Who Runs for Congress? A Study of State Legislators and Congressional Polarization #### 
# Connor Halloran Phillips, James M. Snyder, Jr., and Andrew B. Hall ####################
# Quarterly Journal of Political Science ################################################
# README File ###########################################################################
#########################################################################################

	This file outlines the software, code, and data used to produce the results presented 
	in "Who Runs for Congress? A Study of State Legislators and Congressional Polarization," 
	by Connor Phillips, James Snyder, and Andrew Hall. 
	
	In order to replicate the results from the text and supplemental materials, replicators
	should install Stata and set their working directory to the STATA_Do_Files folder within
	this replication archive. The instructions below include both the specific lines 
	containing the code that constructs each figure and table and, in cases where we change 
	the delimiter within the do-file, the range of lines that should be run to reproduce
	them. Each file can also be replicated by running the entire do-file containing the 
	relevant code. Running a given do-file to the end will additionally clear any temporary 
	files that may be saved during the data analysis.

## Replication Package Contents ##

	## Data ##

	POOLS_DATA FOLDER: This folder contains the main data for our analyses. The basic model 
	is a legislator-election level dataset where each observation is a sitting state 
	legislator within a congressional district contested in a particular election, counting 
	regular biennial general elections and special elections separately. Whether a state 
	legislator is in the pool for a given congressional district is determined by whether a
	certain proportion of their constituents is also located within that district: a "33" in
	the file name indicates that this cutoff is 1/3 (our main specification), while a "25" 
	or a "50" indicates that it is 1/4 or 1/2 respectively. Separate files are present for
	each party. Finally, files whose names end with _prev_cycle also include former state 
	legislators as of that congressional election who served in those districts at any point
	during the current or previous two-year election cycle. 

	"merged_data_25_dems.dta"
	"merged_data_25_dems_prev_cycle.dta"
	"merged_data_25_reps.dta"
	"merged_data_25_reps_prev_cycle.dta"

	"merged_data_33_dems.dta"
	"merged_data_33_dems_prev_cycle.dta"
	"merged_data_33_reps.dta"
	"merged_data_33_reps_prev_cycle.dta"

	"merged_data_50_dems.dta"
	"merged_data_50_dems_prev_cycle.dta"
	"merged_data_50_reps.dta"
	"merged_data_50_reps_prev_cycle.dta"	

	OTHER_DATA FOLDER: This folder holds additional data used in certain analyses.

	"cong_incumbency.dta" indicates whether a party had an incumbent running for re-election 
	in each congressional election during the period of our study.

	"cong_primaries_1996_2016.dta" contains the names and parties of all candidates who ran 
	in congressional primaries during our period along with the outcomes of these primaries 
	and subsequent general elections.

	"dime_cong_elections_current.dta" provides CFScores (campaign finance-based ideological 
	scores from Adam Bonica's Database on Ideology, Money in Politics, and Elections) for 
	congressional candidates.

	"npat_and_nominate_table.dta" has ideological scores for congressional candidates based 	
	on the National Political Awareness Test and for members of Congress from W-NOMINATE.

	"num_state_legs_and_cong_dists.dta" gives the number of congressional and state
 	legislative districts in each state during our period of study.

	"pres_vote_to_use.dta" presents the normalized two-party Democratic presidential vote in
 	each congressional district during our period of study.

	"shor_mccarty_1993_2016_long_with_ids.dta" consists of Shor-McCarty NP-Scores for state
 	legislators, together with additional identifiers to aid in merging data.

	"state_codes.dta" compiles various identification codes used for the states in order to
 	aid in merging.

	## Code ##

	STATA_DO_FILES FOLDER: This folder contains the code to replicate the results.

	"appendix_tables.do" contains the code for APPENDIX B, reversing the direction of the 
	main results from Tables 3 and 4 in the text (i.e., predicting the probability of 
	running/winning from ideology rather than quantifying the ideological differences 
	between runners/winners and non-runners/non-winners in each pool).
 
	"binscatter.ado" is an add-on that should be installed in order to produce the graphs in 
	the main_graphs_cutoff_**.do files.

	"campaign_finance_scores.do" produces TABLE 6 in the text (comparing the ideology of 
	congressional candidates who are state legislators to the ideology of all congressional 
	candidates). 

	"expanded_pools.do" contains the code for APPENDIX D, replicating the main analyses in 
	Tables 2, 3, and 4 and Appendix Table E3 (the ideological differences between runners 
	and non-runners overall, within-pool, and within-pool for certain subsets of pools, as 
	well as the within-pool ideological differences between primary and general election 
	winners and non-winners) for an expanded definition of the pools that includes state 
	legislators who served within the previous congressional election cycle as well as 
	sitting state legislators. It also replicates various supplemental analyses discussed in
	the text for these expanded pools.

	"main_analyses_cutoff_25.do" replicates the main analyses in Tables 3 and 4 (the 
	within-pool ideological differences between runners and non-runners as well as between 
	primary and general election winners and non-winners), along with the auxiliary 
	comparisons in the text and Appendices C and E, for an alternate definition of the pools
	in which state legislators are in the pool for every congressional district containing 
	at least 25% of their constituents. It produces APPENDIX TABLES A3-25 AND A4-25.  

	"main_analyses_cutoff_33.do" contains most of the main regression analyses, specifically
	those measuring ideological differences between runners and non-runners overall and 
	within-pool as well as the within-pool ideological differences between primary and 
	general election winners and non-winners. It also conducts supplemental analyses 
	examining whether these relationships differ using alternative measures of ideology or
	within particular subsets of pools and constructs density plots depicting the 
	distribution of ideology for runners and non-runners. Finally, it computes several other
	values related to these analyses discussed in the text and saves those to the Output/
	Numbers_in_Text folder (as NUMBER_19.TEX AND NUMBER_20.TEX, along with NUMBER_25.TEX 
	THROUGH NUMBER_33.TEX consecutively). It produces TABLES 2, 3, AND 4; FIGURE 4; APPENDIX
	TABLES C2-1, C2-2, C2-3, C3-1, C3-2, AND C3-3; AND APPENDIX TABLE E3.

	"main_analyses_cutoff_50.do" replicates the main analyses in Tables 3 and 4 (the 
	within-pool ideological differences between runners and non-runners as well as between
	primary and general election winners and non-winners), along with the auxiliary 
	comparisons in the text and Appendices C and E, for an alternate definition of the pools
	in which state legislators are in the pool only for a congressional district that 
	contains at least 50% of their constituents. It produces APPENDIX TABLES A3-50 AND A4-
	50.  

	"main_graphs_cutoff_25.do" replicates the plots in Figures 5 and 6, showing the average 
	within-pool difference in ideology between runners and non-runners for both parties 
	across congressional district partisanship and across time, for an alternate definition 
	of the pools in which state legislators are in the pool for every congressional district
	containing at least 25% of their constituents. It produces APPENDIX FIGURES A5-25 AND 
	A6-25.

	"main_graphs_cutoff_33.do" produces the main plots of the paper, FIGURES 1, 2, 3, 5, AND
	6, which respectively show the size of pools and average pool-level ideology across 
	congressional district partisanship, the average ideology of different types of pools 
	over time, and the average within-pool difference in ideology between runners and non-
	runners for both parties across congressional district partisanship and across time. It 
	also produces the normalized version of the pool-size figure mentioned in the text.

	"main_graphs_cutoff_50.do" replicates the plots in Figures 5 and 6, showing the average 
	within-pool difference in ideology between runners and non-runners for both parties 
	across congressional district partisanship and across time, for an alternate definition 
	of the pools in which state legislators are in the pool only for a congressional 
	district that contains at least 50% of their constituents. It produces APPENDIX FIGURES 
	A5-50 AND A6-50.

	"misc_numbers_in_text.do" outputs most of the specific values mentioned in the body of 
	the paper (saved in the Numbers_for_Text folder as NUMBER_1.TEX THROUGH NUMBER_18.TEX, 
	along with NUMBER_21.TEX).

	"npat_and_nominate.do" produces TABLE 5 in the text, comparing the ideology of state 
	legislators who run for Congress with that of other congressional candidates using NPAT
	ideological scores and that of those who make it to Congress with that of other members 
	using W-NOMINATE, as well as outputting values related to these datasets mentioned in 
	the text (NUMBER_22.TEX THROUGH NUMBER_24.TEX in the Numbers_for_Text folder).

	"pool_stats_cutoff_25.do" replicates the descriptive analyses of the pools in 
	pool_stats_cutoff_33.do for an alternate definition of the pools in which state 
	legislators are in the pool for every congressional district containing at least 25% of 
	their constituents, producing APPENDIX TABLE A1-25.

	"pool_stats_cutoff_33.do" conducts various descriptive analyses of the pools, including 
	outputting TABLE 1 (pool summary statistics) and APPENDIX TABLE F1 (analyzing whether 
	the excluded pools problematically differ from the included ones).

	"pool_stats_cutoff_50.do" replicates the descriptive analyses of the pools in 
	pool_stats_cutoff_33.do for an alternate definition of the pools in which state 
	legislators are in the pool only for a congressional district that contains at least 50%
	of their constituents, producing APPENDIX TABLE A1-50.

	"running_by_year.do" examines the proportions of state legislators who run for Congress 
	in our period as incumbents and at various points after leaving the legislature, saving 
	the proportion of all state legislators who run for Congress represented in the expanded
	pools, which is reported in the text of Appendix D, in the Numbers_for_Text folder as 
	NUMBER_34.TEX.

	## Output ##

	OUTPUT FOLDER: Contains three subfolders, Figures, Numbers_for_Text, and Tables, to 
	which the code in STATA_Do_Files outputs figures, specific values reported in the body 
	of the paper, and tables respectively. For figures and tables included in the main text
	or appendix, the corresponding figure/table is indicated in parentheses. 

	Figures:
	
	"ideo_diff_D_vs_dem_pres_share_25.pdf" (Figure A5-25)
	"ideo_diff_D_vs_dem_pres_share_33.pdf" (Figure 5)
	"ideo_diff_D_vs_dem_pres_share_50.pdf" (Figure A5-50)
	"ideo_diff_D_vs_year_25.pdf" (Figure A6-25)
	"ideo_diff_D_vs_year_33.pdf" (Figure 6)
	"ideo_diff_D_vs_year_50.pdf" (Figure A6-50)
	"ideo_diff_R_vs_dem_pres_share_25.pdf" (Figure A5-25)
	"ideo_diff_R_vs_dem_pres_share_33.pdf" (Figure 5)
	"ideo_diff_R_vs_dem_pres_share_50.pdf" (Figure A5-50) 
	"ideo_diff_R_vs_year_25.pdf" (Figure A6-25)
	"ideo_diff_R_vs_year_33.pdf" (Figure 6)
	"ideo_diff_R_vs_year_50.pdf" (Figure A6-50)
	"ideo_mean_D_vs_dem_pres_share_33" (Figure 2)
	"ideo_mean_R_vs_dem_pres_share_33" (Figure 2)
	"kernal_density_D_33.pdf" (Figure 4)
	"kernal_density_R_33.pdf" (Figure 4)
	"pool_ideology_D_33.pdf" (Figure 3)
	"pool_ideology_R_33.pdf" (Figure 3)
	"pool_size_D_33.pdf" (Figure 1)
	"pool_size_D_norm_33.pdf"
	"pool_size_R_33.pdf" (Figure 1)
	"pool_size_R_norm_33.pdf"

	Numbers_for_Text:

	"number_1.tex" (% of congressional candidates who are state legislators)
	"number_2.tex" (% of primary election winners who are state legislators)
	"number_3.tex" (% of general election winners who are state legislators)
	"number_4.tex" (% of candidates who do not run in the CD that most overlaps their SLD)
	"number_5.tex" (# of candidates who do not run in the CD that most overlaps their SLD)
	"number_6.tex" (% of state legislators placed in multiple pools)
	"number_7.tex" (% of congressional candidates who are sitting state legislators)
	"number_8.tex" (% of primary election winners who are sitting state legislators)
	"number_9.tex" (% of general election winners who are sitting state legislators)
	"number_10.tex" (# of pools represented in dataset)
	"number_11.tex" (# of unique individuals in dataset)
	"number_12.tex" (% of districts that are competitive overall)
	"number_13.tex" (% of districts that are competitive in 1996)
	"number_14.tex" (% of districts that are competitive in 2016)
	"number_15.tex" (# of empty Democratic pools)
	"number_16.tex" (% of Democratic pools that are empty)
	"number_17.tex" (# of empty Republican pools)
	"number_18.tex" (% of Republican pools that are empty)
	"number_19.tex" (Diff. in median NP-Score between Republican runners and non-runners)
	"number_20.tex" (Diff. in median NP-Score between Democratic runners and non-runners)
	"number_21.tex" (# of Democratic general election winners in competitive districts)
	"number_22.tex" (% of congressional candidates with NPAT scores)
	"number_23.tex" (% of state legislator congressional candidates with NPAT scores)
	"number_24.tex" (% of non-state legislator congressional candidates with NPAT scores)
	"number_25.tex" (Beta on Ran in model with Ran*Very Safe District interaction)
	"number_26.tex" (SE for beta on Ran in model with Ran*Very Safe District interaction)
	"number_27.tex" (Beta on Ran*Very Safe District in model with that interaction)
	"number_28.tex" (SE for beta on Ran*Very Safe District in model with that interaction)
	"number_29.tex" (Aggregate increase in polarization over period)
	"number_30.tex" (Increase in gap between Republican and Democratic pools over period)
	"number_31.tex" (% of increase in polarization coming from polarization of pools)
	"number_32.tex" (Increase in polarization coming from growth of safe districts)
	"number_33.tex" (% of increase in polarization coming from growth of safe districts)
	"number_34.tex" (% of state legislators who run within two years of service)

	Tables:
	
	"tbl_appendix_logit_run_33.tex" (Table B3-2)
	"tbl_appendix_logit_win_prim_genl_33.tex" (Table B4-2)
	"tbl_appendix_lpm_run_33.tex" (Table B3-1)
	"tbl_appendix_lpm_win_prim_genl_33.tex" (Table B4-1)
	"tbl_main_regressions_run_25.tex" (Table A3-25)
	"tbl_main_regressions_run_33.tex" (Table 3)
	"tbl_main_regressions_run_33_dummy.tex" (Table C3-2)
	"tbl_main_regressions_run_33_dummy2.tex" (Table C3-3)
	"tbl_main_regressions_run_33_expanded_pool.tex" (Table D3)
	"tbl_main_regressions_run_33_more_heterogeneity.tex" (Table E3)
	"tbl_main_regressions_run_33_rank.tex" (Table C3-1)
	"tbl_main_regressions_run_50.tex" (Table A3-50)
	"tbl_main_regressions_win_prim_genl_25.tex" (Table A4-25)
	"tbl_main_regressions_win_prim_genl_33.tex" (Table 4)
	"tbl_main_regressions_win_prim_genl_33_expanded_pool.tex" (Table D4)
	"tbl_main_regressions_win_prim_genl_50.tex" (Table A4-50)
	"tbl_missing_checks.tex" (Table F1)
	"tbl_state_legs_vs_others_1.tex" (Table 5)
	"tbl_state_legs_vs_others_2.tex" (Table 6)
	"tbl_summary_runners_nonrunners_33.tex" (Table 2)
	"tbl_summary_runners_nonrunners_33_dummy.tex" (Table C2-2)
	"tbl_summary_runners_nonrunners_33_dummy2.tex" (Table C2-3)
	"tbl_summary_runners_nonrunners_33_expanded_pool.tex" (Table D2)
	"tbl_summary_runners_nonrunners_33_rank.tex" (Table C2-1)
	"tbl_summary_stats_25.tex" (Table A1-25)
	"tbl_summary_stats_33.tex" (Table 1)
	"tbl_summary_stats_50.tex" (Table A1-50)
	
## Tables and Figures ##

	## In Text (Listed in Order of Appearance) ##

	Figure 1 - Size of Candidate Pools Across Presidential Vote Share: Code located in lines
	4-54 of main_graphs_cutoff_33.do. Files located in Output/Figures/pool_size_D_33.pdf and
	Output/Figures/pool_size_R_33.pdf.

	Table 1 - NP-Scores of State Legislators, by Party: Code located in lines 79-325, 332-
	394 of pool_stats_cutoff_33.tex (to replicate, run lines 1-394). File located in 
	Output/Tables/tbl_summary_stats_33.tex.

	Figure 2 - Average NP-Score of Pools Across Presidential Vote Share: Code located in 
	lines 4-42, 80-92 of main_graphs_cutoff_33.do. Files located in 
	Output/Figures/ideo_mean_D_vs_dem_pres_share_33.pdf and 
	Output/Figures/ideo_mean_R_vs_dem_pres_share_33.pdf.

	Figure 3 - Average NP-Score of Pools Over Time: Code located in lines 253-477 of 
	main_graphs_cutoff_33_do. Files located in Output/Figures/pool_ideology_D_33.pdf and 
	Output/Figures/pool_ideology_R_33.pdf.

	Table 2 - NP-Score of State Legislators Who Run vs. Those Who Do Not: Code located in 
	lines 10-29, 46-60, 74-97 of main_analyses_cutoff_33.do (to replicate, run lines 1-97). 
	File located in Output/Tables/tbl_summary_runners_nonrunners_33.tex.

	Figure 4 - Differences in Ideological Distributions of NP-Scores, Runners vs. Non-
	Runners: Code located in lines 10-29, 99-116 of main_analyses_cutoff_33.do (to 
	replicate, run lines 1-116). Files located in Output/Figures/kernal_density_D_33.pdf and 
	Output/Figures/kernal_density_R_33.pdf. 

	Table 3 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those Who 
	Do Not: Code located in lines 322-346, 402-420, 578-603, 659-677, 893-918 of 
	main_analyses_cutoff_33.do (to replicate, run lines 1-918). File located in 
	Output/Tables/tbl_main_regressions_run_33.tex.

	Figure 5 - Within-Pool Difference in NP-Score Between State Legislators Who Ran and Did 
	Not Run Across Presidential Vote Share: Code located in lines 98-134, 139-146, 178-209, 
	214-220 of main_graphs_cutoff_33.tex. Files located in 
	Output/Figures/ideo_diff_D_vs_dem_pres_share_33.pdf and 
	Output/Figures/ideo_diff_R_vs_dem_pres_share_33.pdf.

	Figure 6 - Ideology of State Legislators Who Ran and Did Not Run Over Time: Code located
	in lines 98-134, 149-153, 178-209, 223-227 of main_graphs_cutoff_33.do. Files located in
	Output/Figures/ideo_diff_D_vs_year_33.pdf and Output/Figures/ideo_diff_R_vs_year_33.pdf.

	Table 4 - Within-Pool Comparisons: NP-Score of State Legislators Who Win Primary or 
	General Elections vs. Others: Code located in lines 322-360, 453-492, 578-617, 709-748, 
	951-980 of main_analyses_cutoff_33.do (to replicate, run lines 1-980). File located in 
	Output/Tables/tbl_main_regressions_win_prim_genl_33.tex.

	Table 5 - Ideology of State Legislators Compared to Non-State Legislators: Code located
	in lines 9-38, 46-78 of npat_and_nominate.do (to replicate, run lines 1-78). File 
	located in Output/Tables/tbl_state_legs_vs_others_1.tex.

	Table 6 - Ideology of State Legislators Compared to Non-State Legislators, CFScores: 
	Code located in lines 8-85, 93-119 of campaign_finance_scores.do (to replicate, run 
	lines 1-119). File located in Output/Tables/tbl_state_legs_vs_others_2.tex.

	## In Appendix (Listed in Order of Appearance)

	Table A1-25 - NP-Scores of State Legislators, by Party (Threshold to Define Pools = 25 
	Percent): Code located in lines 79-325, 332-394 of pool_stats_cutoff_25.do (to 
	replicate, run lines 1-394). File located in Output/Tables/tbl_summary_stats_25.tex.

	Table A1-50 - NP-Scores of State Legislators, by Party (Threshold to Define Pools = 50 
	Percent): Code located in lines 79-325, 332-394 of pool_stats_cutoff_50.do (to 
	replicate, run lines 1-394). File located in Output/Tables/tbl_summary_stats_50.tex.

	Table A3-25 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those 
	Who Do Not (Threshold to Define Pools = 25 Percent): Code located in lines 11-37, 86-
	104, 233-260, 309-327, 479-504 of main_analyses_cutoff_25.do (to replicate, run lines 1-
	504). File located in Output/Tables/tbl_main_regressions_run_25.tex.

	Table A3-50 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those 
	Who Do Not (Threshold to Define Pools = 50 Percent): Code located in lines 11-37, 86-
	104, 233-260, 309-327, 479-504 of main_analyses_cutoff_50.do (to replicate, run lines 1-
	504). File located in Output/Tables/tbl_main_regressions_run_50.tex.

	Figure A5-25 - Within-Pool Difference in NP-Score Between State Legislators Who Ran and 
	Did Not Run Across Presidential Vote Share (Threshold to Define Pools = 25 Percent): 
	Code located in lines 4-29, 34-41, 51-82, 87-93 of main_graphs_cutoff_25.do. Files 
	located in Output/Figures/ideo_diff_D_vs_dem_pres_share_25.pdf and 
	Output/Figures/ideo_diff_R_vs_dem_pres_share_25.pdf.

	Figure A5-50 - Within-Pool Difference in NP-Score Between State Legislators Who Ran and 
	Did Not Run Across Presidential Vote Share (Threshold to Define Pools = 50 Percent): 
	Code located in lines 4-29, 34-41, 51-82, 87-93 of main_graphs_cutoff_25.do. Files 
	located in Output/Figures/ideo_diff_D_vs_dem_pres_share_50.pdf and 
	Output/Figures/ideo_diff_R_vs_dem_pres_share_50.pdf.

	Figure A6-25 - Ideology of State Legislators Who Ran and Did Not Run Over Time
	(Threshold to Define Pools = 25 Percent): Code located in lines 4-29, 44-48, 51-82, 96-
	100 of main_graphs_cutoff_25.do. Files located in 
	Output/Figures/ideo_diff_D_vs_year_25.pdf and Output/Figures/ideo_diff_R_vs_year_25.pdf.

	Figure A6-50 - Ideology of State Legislators Who Ran and Did Not Run Over Time
	(Threshold to Define Pools = 50 Percent): Code located in lines 4-29, 44-48, 51-82, 96-
	100 of main_graphs_cutoff_50.do. Files located in 
	Output/Figures/ideo_diff_D_vs_year_50.pdf and Output/Figures/ideo_diff_R_vs_year_50.pdf.
	
	Table A4-25 - Within-Pool Comparisons: NP-Score of State Legislators Who Win Primary or 
	General Elections vs. Others (Threshold to Define Pools = 25 Percent): Code located in 
	lines 11-50, 137-176, 233-273, 359-398, 508-537 of main_analyses_cutoff_25.do (to 
	replicate, run lines 1-537). File located in 
	Output/Tables/tbl_main_regressions_win_prim_genl_25.tex.

	Table A4-50 - Within-Pool Comparisons: NP-Score of State Legislators Who Win Primary or 
	General Elections vs. Others (Threshold to Define Pools = 50 Percent): Code located in 
	lines 11-50, 137-176, 233-273, 359-398, 508-537 of main_analyses_cutoff_50.do (to 
	replicate, run lines 1-537). File located in 
	Output/Tables/tbl_main_regressions_win_prim_genl_50.tex.

	Table B3-1 - Within-Pool Comparisons: Predicting Probability of Running from Ideology:
	Code located in lines 11-35, 60-78, 190-215, 237-255, 367-391 of appendix_tables.do (to 
	replicate, run lines 1-391). File located in Output/Tables/tbl_appendix_lpm_run_33.tex.

	Table B4-1 - Within-Pool Comparisons: Predicting Probability of Winning Primary or 
	General Election from Ideology: Code located in lines 11-48, 81-120, 190-228, 258-297, 
	395-424 of appendix_tables.do (to replicate, run lines 1-424). File located in 
	Output/Tables/tbl_appendix_lpm_win_prim_genl_33.tex.

	Table B3-2 - Within-Pool Comparisons: Logistic Regression of Running on Ideology: Code 
	located in lines 11-35, 125-143, 190-215, 300-318, 427-451 of appendix_tables.do (to 
	replicate, run lines 1-451). Files located in 
	Output/Tables/tbl_appendix_logit_run_33.tex.

	Table B4-2 - Within-Pool Comparisons: Logistic Regression of Winning Primary or General 
	Election on Ideology: Code located in lines 11-48, 146-185, 190-228, 321-360, 455-484 of 
	appendix_tables.do (to replicate, run lines 1-484). Files located in 
	Output/Tables/tbl_appendix_logit_win_prim_genl_33.tex.

	Table C2-1 - NP-Score of State Legislators Who Run vs. Those Who Do Not, Rank of 
	Ideology: Code located in lines 10-34, 151-165, 179-202 of main_analyses_cutoff_33.do 
	(to replicate, run lines 1-202). File located in 
	Output/Tables/tbl_summary_runners_nonrunners_33_rank.tex.

	Table C2-2 - NP-Score of State Legislators Who Run vs. Those Who Do Not, Dummy of 
	Ideology: Code located in lines 10-29, 36-38, 208-222, 236-259 of 
	main_analyses_cutoff_33.do (to replicate, run lines 1-259). File located in 
	Output/Tables/tbl_summary_runners_nonrunners_33_dummy.tex.

	Table C2-3 - NP-Score of State Legislators Who Run vs. Those Who Do Not, Dummy of 
	Ideology Relative to Pool: Code located in lines 10-29, 40-44, 265-279, 293-316 of 
	main_analyses_cutoff_33.do (to replicate, run lines 1-316). File located in 
	Output/Tables/tbl_summary_runners_nonrunners_33_dummy2.tex.

	Table C3-1 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those 
	Who Do Not, DV = Rank of Ideology: Code located in Lines 322-346, 369-372, 498-516, 578
	-603, 626-629, 754-772, 983-1007 of main_analyses_cutoff_33.do (to replicate, run lines 
	1-1007). File located in Output/Tables/tbl_main_regressions_run_33_rank.tex.

	Table C3-2 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those 
	Who Do Not, DV = Dummy of Ideology: Code located in lines 322-346, 374-376, 519-537, 
	578-603, 631-633, 775-793, 1011-1035 of main_analyses_cutoff_33.do (to replicate, run 
	lines 1-1035). File located in Output/Tables/tbl_main_regressions_run_33_dummy.tex.

	Table C3-3 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those 
	Who Do Not, DV = Dummy of Ideology Relative to Pool: Code located in lines 322-346, 378
	-382, 540-558, 578-603, 635-639, 796-814, 1037-1061 of main_analyses_cutoff_33.do (to 
	replicate, run lines 1-1061). File located in 
	Output/Tables/tbl_main_regressions_run_33_dummy2.tex.

	Table D2 - NP-Score of State Legislators Who Run vs. Those Who Do Not - Expanded Pool 
	Including Retired State Legislators: Code located in lines 10-48, 63-86 of 
	expanded_pools.do (to replicate, run lines 1-86). File located in 
	Output/Tables/tbl_summary_runners_nonrunners_33_expanded_pool.tex. 

	Table D3 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those Who 
	Do Not - Expanded Pool Including Retired State Legislators: Code located in lines 94-
	130, 154-220, 275-312, 336-401, 481-510 of expanded_pools.do (to replicate, run lines 1
	-510). File located in Output/Tables/tbl_main_regressions_run_33_expanded_pool.tex. 
	
	Table D4 - Within-Pool Comparisons: NP-Score of State Legislators Who Win Primary or 
	General Elections vs. Others - Expanded Pool Including Retired State Legislators: Code
	located in lines 94-145, 223-262, 275-327, 404-443, 513-542 of expanded_pools.do (to 
	replicate, run lines 1-542). File located in 
	Output/Tables/tbl_main_regressions_win_prim_genl_33_expanded_pool.tex.

	Table E3 - Within-Pool Comparisons: NP-Score of State Legislators Who Run vs. Those Who
	Do Not, Additional Results on Heterogeneity: Code located in lines 322-346, 384-399, 
	423-450, 578-603, 641-656, 679-706, 922-947 of main_analyses_cutoff_33.do (to replicate,
	run lines 1-947). File located in 
	Output/Tables/tbl_main_regressions_run_33_more_heterogeneity.tex.

	Table F1 - Missing vs. Non-Missing Districts: Code located in lines 402-469 of 
	pool_stats_cutoff_33.do (to replicate, run lines 1-469). File located in 
	Output/Tables/tbl_missing_checks.tex.

## Other Results ##

	All exact numbers in the body of the text are also produced by the code and taken from 
	the Numbers_for_Text subfolder of the Output file (with the exception of the total 
	number of potential pools in the dataset and the breakdown of the missing pools by 
	reason for missingness). Each of these can be replicated by finding the appropriate do-
	file as indicated by the table of contents above, searching for the line where the 
	number is outputted (e.g., searching "number_1.tex"), and running the code through that 
	point. In addition, there are several results referenced in the text not reported in 
	tables or figures:
	
	- Footnote 10 describes a normalized version of Figure 1. The code to produce this 
	result is located in lines 4-42, 57-76 of main_graphs_cutoff_33.do, with files located 
	in Output/Figures/pool_size_D_norm_33.pdf and Output/Figures/pool_size_R_norm_33.pdf.

	- Footnote 12 reports significance tests for Table 2, specifically a simple t-test and 
	one with standard errors clustered by legislator for each party. The code to run these 
	tests is located in lines 10-29, 62-63, 65-66 of main_analyses_cutoff_33.do (to 
	replicate, run lines 1-62; 1-63 for the Democrats and lines 1-65; 1-66 for the 
	Republicans).

	- Footnote 19 references a significance test for an analysis of Democrats analogous to 
	the reported one for Republicans. The code to run this test is located in lines 322-346,
	563-564 of main_analyses_cutoff_33.do (to replicate, run lines 1-564).

	- The discussion of Figure 5 in the text notes that more competitive districts have 
	become safe Republican districts than have become safe Democratic districts. The relevant
	code is located in lines 278-291 of misc_numbers_in_text.do (to replicate, run lines 1-
	291).

	- Footnote 21 shares results of t-tests comparing coefficients in Table 4 for 
	Republicans. The relevant code is located in lines 578-617, 827-845 of 
	main_analyses_cutoff_33.do (to replicate, run lines 1-832; 1-835; 1-842; 1-845).

	- The discussion of Table 4 in the text includes significance results for a time trend 
	interacted with Won Primary and Won General. The relevant code is located in lines 322-
	360, 570-572, 578-617, 819-821 of main_analyses_cutoff_33.do (to replicate, run lines 1
	-571; 1-572 for the Democrats and lines 1-820; 1-821 for the Republicans). 

	- Footnote 24 provides significance results for a year interaction with the state 
	legislator dummy in Table 6. The relevant code is located in lines 8-61, 90-91 of 
	campaign_finance_scores.do (to replicate, run lines 1-90 for the Democrats and lines 1-
	91 for the Republicans).

	- The discussion of Table E3 in Appendix E mentions significance results for comparisons
	of the coefficients in the table among Republicans. The relevant code is located in 
	lines 578-603, 641-656, 679-681, 694-696 of main_analyses_cutoff_33.do (to replicate, 
	run lines 1-681; 1-696).

## Software Dependencies ##

All code was run on 64bit Windows 10 using Stata/MP 17.0. In addition, some of the graphs 
require use of the binscatter package, which is provided in the STATA_Do_Files folder.

To install binscatter, set the working directory to the STATA_Do_Files folder as above and run 
the following code in Stata:

copy binscatter.ado "`c(sysdir_plus)'"
discard