**************************************************************************************************************
*** Replication file for Feinstein, Yuval & Andreas Wimmer. 2023. "Consent and legitimacy." World Politics ***
**************************************************************************************************************

*** Use FeinsteinWimmer2023General data file, unless specified otherwise ***

*** Table 2 ***
*Models 1&2 (use FeinsteinWimmer2023_Table1_Models1&2 data file)
xtscc tax lattacked_onset lassemblies2 i.period, fe
xtscc tax lattacked_onset lassemblies2 lassemattacked2  i.period, fe
*Models 3&4 (use FeinsteinWimmer2023_Table1_Models3&4 data file)
xtscc tax lattacked_onset lassemblies_century2 i.century, fe
xtscc tax lattacked_onset lassemblies_century2 lattacked_onset_assem2 i.century, fe

*** Table 3 ***
xtscc exp_gdp lwars1860on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe
xtscc exp_gdp lwars_democracy lwars_nondemoc ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe 
xtscc exp_gdp lcasualties_area ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop   if year>=1860, fe 
xtscc exp_gdp lwars_oil lwars_nooil ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe 
xtscc exp_gdp lwars_aid lwars_noaid ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop , fe
xtscc exp_gdp  lwars_tax  lwars_notax ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if funding_data==1, fe
xtscc exp_gdp lwars_noextfund lwars_extfund  ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if funding_data==1, fe
xtscc exp_gdp lwarswon lwarslost ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe 
xtscc exp_gdp lwars_postNSF  lwars_preNSF  ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if year>=1860, fe 

*** Table 4 ***
xtscc exp_gdp lwars_democpredict lwars_nondemoc ///
ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop , fe
xtscc exp_gdp lwars_nspredict lnonns_wars ///
ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop, fe

*** Table 5 ***
xtscc exp_gdp lwars_initiated_dem_1860cum-lwars_forced_nondem_1860cum newwars_v2 lwarsneighbors ///
lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop if year>=1860 & year<=1982, fe
xtscc exp_gdp lwars_initiated_dem_wm_cum-lwars_forced_nondem_wm_cum newwars_wm ///
lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs*, fe

*** Table 6 ***
ivreg2 statehist1850 interwars1800 stateness13511400 state1350_wars1800  elevdiff1000 abs_latclip lpd1500 sea_distclip   zagritran stateness13511400 state1350_wars1800 (ethfrac= erange_geconclip rangeclip) i.Continent if year==1994, first robust

*Model 2 (use FeinsteinWimmer2023_Table6_Model2 data file)
keep cowcode aosnew lglobalwins lwarsnoglobal fifty Continent
xtreg aosnew lglobalwins lwarsnoglobal fifty if (Continent==0 | Continent==7), fe

*Models 3-8
xtscc exp_gdp lwars1860on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop if year<1946, fe
xtscc exp_gdp lwars1946on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop,  fe
xtscc exp_gdp lwars1860on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop if year<1946 & Continent~=1 & Continent~=3 & Continent~=5, fe
xtscc exp_gdp lwars1860on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop if year<1946 & (Continent==1 | Continent==3 | Continent==5), fe
xtscc exp_gdp lwars1946on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop if Continent~=1 & Continent~=3 & Continent~=5, fe
xtscc exp_gdp lwars1946on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop if (Continent==1 | Continent==3 | Continent==5), fe

*** Appendix Table 1 *** 
*1 year lag (see Table 3 above)

*10 years lag
xtscc exp_gdp l9.lwars1860on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe
xtscc exp_gdp l9.lwars_democracy l9.lwars_nondemoc ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop , fe 
xtscc exp_gdp l9.lcasualties_area ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if year>=1860, fe 
xtscc exp_gdp l9.lwars_oil l9.lwars_nooil ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop , fe 
xtscc exp_gdp l9.lwars_aid l9.lwars_noaid ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop , fe
xtscc exp_gdp  l9.lwars_tax  l9.lwars_notax ongowars_inter ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if funding_data==1, fe
xtscc exp_gdp l9.lwars_noextfund l9.lwars_extfund ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if funding_data==1, fe
xtscc exp_gdp l9.lwarswon l9.lwarslost ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe 
xtscc exp_gdp l9.lwars_postNSF ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop if year>=1860, fe
*20 years lag
xtscc exp_gdp l19.lwars1860on ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe
xtscc exp_gdp l19.lwars_democracy l19.lwars_nondemoc ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop , fe 
xtscc exp_gdp l19.lcasualties_area ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if year>=1860, fe 
xtscc exp_gdp l19.lwars_oil l19.lwars_nooil ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop , fe 
xtscc exp_gdp l19.lwars_aid l19.lwars_noaid ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 year pop , fe
xtscc exp_gdp  l19.lwars_tax  l19.lwars_notax ongowars_inter ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if funding_data==1, fe
xtscc exp_gdp l19.lwars_noextfund l19.lwars_extfund ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  if funding_data==1, fe
xtscc exp_gdp l19.lwarswon l19.lwarslost ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop  , fe 
xtscc exp_gdp l19.lwars_postNSF ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop if year>=1860, fe

*** Appendix Table 2 *** 
xtscc exp_gdp  ///
 ldem0ns0oil0_wars ldem0ns1oil0_wars ///
ldem0ns1oil1_wars  ///
 ldem0ns0oil1_wars  ///
 ldem1ns1oil0_wars ldem1ns1oil1_wars ///
 ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs*  pop , fe

*** Appendix Table 3 *** 
xtscc exp_gdp lwaryrs1860on   ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* , fe
xtscc exp_gdp ldemwars   lnondemwars ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* , fe 
xtscc exp_gdp lwaryrs_oil lwaryrs_nooil ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* , fe 
xtscc exp_gdp lwaryrs_aid lwaryrs_noaid ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop year , fe
xtscc exp_gdp  lwaryrs_tax lwaryrs_notax   /// 
ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* if funding_data==1, fe
xtscc exp_gdp lwaryrs_noextfund  lwaryrs_extfund   /// 
ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* if funding_data==1, fe
xtscc exp_gdp lwaryrs_postNSF lwaryrs_preNSF  ongowars_inter lwarsneighbors /// 
lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs*  if year>=1860, fe 

*** Appendix Table 4 *** 
xtscc exp_gdp lwars_demcont lwars_nondemoc ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* , fe 
xtscc exp_gdp lwars_oilcont lwars_nooil ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop cs* , fe 
xtscc exp_gdp lwars_aidcont lwars_noaid ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 pop year , fe

*** Appendix Table 5 *** 
xtscc exp_gdp lcasualties_pop ongowars_inter lwarsneighbors lcommunistrule lanarc lanoc ldemoc  loilpc llngdp1996 cs* pop   if year>=1860, fe