{smcl}
{com}{sf}{ul off}{txt}
{com}. 
. **** REPLICATION OF FIGURE 3 ****
. 
. clear all
{res}{txt}
{com}. set mem 2g
{txt}{bf:set memory} ignored.
{p 4 4 2}
Memory no longer
needs to be set in modern Statas;
memory adjustments are performed on the fly
automatically.
{p_end}

{com}. set more off
{txt}
{com}. 
. /*      
>         OUTLINE
>         1. DRAW GRAPH
> */
. 
. *************************
. ***** 1. DRAW GRAPH *****
. *************************
. 
. // Parameters
. 
. scalar tau_R1 = 0.1
{txt}
{com}. scalar tau_R2 = 0.5
{txt}
{com}. scalar tau_M = 0
{txt}
{com}. scalar tau_M1 = 0
{txt}
{com}. scalar tau_M2 = 0
{txt}
{com}. scalar tau_H = 0.5
{txt}
{com}. scalar tau_L = 0
{txt}
{com}. scalar c_H = 0.2
{txt}
{com}. scalar c_L = 0
{txt}
{com}. 
. // Make graphs: Little polarization
. 
. twoway  (function y = 0.5 - 0.5*(tau_R1+tau_M1) + (tau_H-tau_L)*x + 0.5*(c_L-c_H)*x/(tau_R1-tau_M1) + tau_L - 0.5*c_L/(tau_R1-tau_M1), range(0 .4) lcolor(navy) lwidth(medthick)) ///
>                 (function y = 0.5 + 0.5*(tau_R1+tau_M1) + (tau_L-tau_H)*x + 0.5*(c_L-c_H)*x/(tau_R1-tau_M1) - tau_L - 0.5*c_L/(tau_R1-tau_M1), range(0 .37) lcolor(navy*.5) lpattern(dash) lwidth(medthick)) ///
>                 (function y = (c_H-c_L)*x/(tau_R1-tau_M1) + c_L/(tau_R1-tau_M1), range(0 .4) lcolor(gs8) lpattern("....._") lwidth(medthick)), ///
>                 xlabel(0(.1).4, angle(0) format(%9.1f) nogrid) xtitle("Share conscripted") ///
>                 ylabel(0(.2).8, angle(0) format(%9.1f)) ytitle("Share of registered voters") ///
>                 graphregion(color(white)) title("Low polarization", ring(0)) name(low, replace) ///
>                 leg(lab(1 "Radical") lab(2 "Moderate") lab(3 "Abstention") c(3) region(color(white)) pos(1) ring(0) symxsize(*0.5) size(vsmall))
{res}{txt}
{com}. 
. // Make graphs: Lots of polarization
. 
. twoway  (function y = 0.5 - 0.5*(tau_R2+tau_M2) + (tau_H-tau_L)*x + 0.5*(c_L-c_H)*x/(tau_R2-tau_M2) + tau_L - 0.5*c_L/(tau_R2-tau_M2), range(0 .4) lcolor(navy) lwidth(medthick)) ///
>                 (function y = 0.5 + 0.5*(tau_R2+tau_M2) + (tau_L-tau_H)*x + 0.5*(c_L-c_H)*x/(tau_R2-tau_M2) - tau_L - 0.5*c_L/(tau_R2-tau_M2), range(0 .4) lcolor(navy*.5) lpattern(dash) lwidth(medthick)) ///
>                 (function y = (c_H-c_L)*x/(tau_R2-tau_M2) + c_L/(tau_R2-tau_M2), range(0 .4) lcolor(gs8) lpattern("....._") lwidth(medthick)), ///
>                 xlabel(0(.1).4, angle(0) format(%9.1f) nogrid) xtitle("Share conscripted") ///
>                 ylabel(0(.2).8, angle(0) format(%9.1f)) ytitle("Share of registered voters") ///
>                 graphregion(color(white)) title("High polarization", ring(0)) name(high, replace) ///
>                 leg(lab(1 "Radical") lab(2 "Moderate") lab(3 "Abstention") c(3) region(color(white)) pos(1) ring(0) symxsize(*0.5) size(vsmall))
{res}{txt}
{com}. 
. // Marginal effect
. 
. scalar alpha1 = 1
{txt}
{com}. 
. twoway  (function y = (tau_H-tau_L)*alpha1 + 0.5*(c_L-c_H)*alpha1/(x-tau_M), range(0.1 0.5) lcolor(navy) lwidth(medthick)) ///
>                 (function y = (tau_L-tau_H)*alpha1 + 0.5*(c_L-c_H)*alpha1/(x-tau_M), range(0.1 0.5) lpattern(dash) lcolor(navy*.5) lwidth(medthick)) ///
>                 (function y = (c_H-c_L)*alpha1/(x-tau_M) + c_L/(x-tau_M), range(0.1 0.5) lcolor(gs8) lpattern("....._") lwidth(medthick)), ///
>                 yline(0, lpattern("-.-")) ///
>                 xlabel(.1(.1).5, angle(0) format(%9.1f) nogrid) xtitle("Polarization") ///                              
>                 ylabel(-2(1)2, angle(0) format(%9.0f)) ytitle("Marginal effect of conscription") ///
>                 graphregion(color(white)) title("Marginal effects", ring(0)) name(mfx, replace) ///
>                 leg(lab(1 "Radical") lab(2 "Moderate") lab(3 "Abstention") c(3) region(color(white)) pos(1) ring(0) symxsize(*0.5) size(small))
{res}{txt}
{com}.         
. // Combine graphs
. 
. grc1leg high low mfx, c(3) graphregion(color(white)) imargin(vsmall) legendfrom(mfx) /// 
>         b1title("", size(vsmall)) l1title("", size(vsmall)) 
{res}{txt}
{com}. graph export "$results\\$program.png", replace width(5400) height(1800)
{txt}{p 0 4 2}
file {bf}
D:\Dropbox\SVLACHOS\Research\Malgre_nous\Replication_files\Results\EEREV-D-21-00004_Figure3.png{rm}
saved as
PNG
format
{p_end}

{com}. 
. cap log close
{smcl}
{com}{sf}{ul off}