****In order to obtain the tables, you will need to change the handle to the location in your computer.
****Use the arabarometer1 datafile. Run the final_manipulation.do file before running the models.
***The marginal effects numbers are manipulated in figure1.xlsx excel file before the data file for marginals is created (use stata 11 IC)
****The graph commands are run with stata 11 IC



***Margins for pooled model****
log using "C:\data\democsharia\marginals.txt", text
****success for both outcomes
margins if e(sample), dydx(*) at(newQ204=1 new2antiWest=1 gender2=1 cntry1=1  cntry2=0  cntry3=0  cntry5=0  cntry6=0  cntry7=0) atmeans predict(p11)
****success for democracy=1
margins if e(sample), dydx(*) at(newQ204=1 new2antiWest=1 gender2=1 cntry1=1  cntry2=0  cntry3=0  cntry5=0  cntry6=0  cntry7=0) atmeans predict(p10)
***success for sharia=1
margins if e(sample), dydx(*) at(newQ204=1 new2antiWest=1 gender2=1 cntry1=1  cntry2=0  cntry3=0  cntry5=0  cntry6=0  cntry7=0) atmeans predict(p01)
***failure for both
margins if e(sample), dydx(*) at(newQ204=1 new2antiWest=1 gender2=1 cntry1=1  cntry2=0  cntry3=0  cntry5=0  cntry6=0  cntry7=0) atmeans predict(p00)
log close



log close

*****use the data file 


***all six charts

label define effects 1 "Political Trust" 2 "Personal Trust" 3 "Gender Attitudes" 4 "Anti West" 5 "Nonsecular" 6 "Islamic View (Economic)" 7 "Islamic View (legal)" 8 "Age" 9 "Female" 10 "Education" 11 "Religious" 12 "Income"
label values vrank effects
label define identity2 1010  "Support for Democracy" 1001 "Support for Sharia"  110  "Conditional Support for Democracy" 111  "Conditional Support for Sharia"  1011  "Support for Sharia and  Democracy" 1100  "No Support for Sharia and Democracy
label values  ident identity2
twoway (dropline prob vrank if probsig==1, mcolor(black) msymbol(smcircle) mlabel(prob) mlabsize(vsmall) mlabcolor(black) mlabposition(12) mlabgap(zero) lcolor(black) lwidth(medthick) lpattern(solid) horizontal), yscale(range(1 12)) ylabel(#12, labels labsize(vsmall) angle(horizontal) valuelabel alternate grid) xtitle(, size(small) orientation(horizontal) justification(center) alignment(baseline)) xscale(range(-12 12)) xline(0) xlabel(#3, labels labsize(small) labcolor(black)) scheme(s2mono) by(, graphregion(fcolor(white))) by(ident) subtitle(, size(small))
graph save Graph "C:\Documents and Settings\ciftci.USERS\Desktop\democracysharia_september18\RandRdatawork\graphs\FinalGraph1.gph", replace



** charts with exclusive and conditional

drop if ident==1011 | ident==1100
twoway (dropline prob vrank if probsig==1, mcolor(black) msymbol(smcircle) mlabel(prob) mlabsize(vsmall) mlabcolor(black) mlabposition(12) mlabgap(zero) lcolor(black) lwidth(medthick) lpattern(solid) horizontal), yscale(range(1 12)) ylabel(#12, labels labsize(vsmall) angle(horizontal) valuelabel alternate grid) xtitle(, size(small) orientation(horizontal) justification(center) alignment(baseline)) xscale(range(-12 12)) xline(0) xlabel(#3, labels labsize(small) labcolor(black)) scheme(s2mono) by(, graphregion(fcolor(white))) by(ident) subtitle(, size(small))
graph save Graph "C:\Documents and Settings\ciftci.USERS\Desktop\democracysharia_september18\RandRdatawork\graphs\FinalGraph2.gph", replace
