---------------------------------------------------------------------------------------------------------------------------- name: log: C:\D\projekte\Replication Gouda_Park 2015\estimations.log log type: text opened on: 3 Mar 2017, 12:53:24 . . **** load data . . set mem 4000m set memory ignored. Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically. . set matsize 9000 . set maxvar 25000 . *use relig_corr, clear . use estimationsample, clear . . *** define locals for sensible variable groupings . local X11 "c.relig" . local X12 "c.relig" . local X13 "c.relig" . . local Z1 "c.relig_country c.corrupt3_country c.denom1country c.denom2country c.denom3country c.denom4country c.denom5count > ry c.denom7country c.denom8country" . local Z2 "i.income i.male i.age i.married i.unempl i.satisf_fin i.educ ib53.denom" . *corr_extent . . *local Z2 "i.lp_legor fi_legprop male_country age_country married_country unempl_country rgdp colonial2-colonial8 wbgi_pse > agedem federal" . * pt_federal . * c.wbgi_cce leave out (1) because it restricts sample size and (2) it's not significant and (3) we can use corrupt3_count > ry instead . *local Z0 "*countryd* *yeard* *regiond*" . . *local Z3 "c.relig_region c.corrupt3_region" . * 88 countries . * 20 years . * 1250 regions . . ** country weights . *bys ccode year: egen countryweight = count(ccode) . . ** generate output table . qui reg corrupt3 `X13' . outreg2 using estimations, excel label(insert) paren(se) ctitle(delete) replace drop(ccode* year* x048*) c:\ado\plus/o/outreg2.ado estimations.xml dir : seeout . . local EST1 "oprobit" . local EST2 "reg" . local EST3 "probit" . local Y1 "corrupt1" . local Y2 "corrupt2" . local Y3 "c.corrupt3" . /* > tab ccode, gen(ctry) > tab year, gen(yr) > tab x048, gen(rgn) > */ . . forval i = 3/3 { 2. /* > di "full set of fixed effects" > * there's not really need for a big exercise in different specifications because the results are very robust > `EST`i'' `Y`i'' `X1`i'' `Z1' `Z2' i.(ctry* yr*) [pw = countryweight], vce(cluster ccode) > > gen sample = (e(sample)==1) > keep if e(sample)==1 > > est store one > est save one, replace > > save estimationsample, replace > > * mean marginal effects (elasticities) for continuous variables > est use one > est esample: if sample == 1 > margins, eyex(`Z1') atmeans noestimcheck post > e > > * mean marginal effects (semi-elasticities) for discrete variables > est use one > est esample: if sample == 1 > > margins, eydx(income male age married unempl satisf_fin educ denom) atmeans noestimcheck post > outreg2 using estimations, excel label(insert) paren(se) ctitle(mdiscrete) drop(ccode* year* x048*) > */ . } . . *** this is just for testing purposes in order to increase do file speed . *keep in 300/700 . . /* > *** descriptives > sum `Z1' `Z2' if sample == 1 > bys cname: sum c.corrupt3 if sample == 1 > > ** descriptives per year > foreach var in relig corrupt3 { > di "`var'" > sum `var', detail > table country year if `var' != ., c(mean `var') format(%12.3f) > } > */ . ******************************* . **** graphing interactions **** . ******************************* . . ** religiosity - continuous variables . /* > foreach var in c.corrupt3_country { > * c.relig_country > * c.denom1country c.denom2country c.denom3country c.denom4country c.denom5country c.denom7country c.denom8country > preserve > cap set more off > gen MV = _n in 1/100 > *replace MV = . if _n > 99 > > > foreach j in 25 50 75 { > * percentiles of relig > gen ME_`j' = . > gen VAR_`j' = . > gen SE_`j' = . > gen lower_`j' = . > gen upper_`j' = . > > foreach i in 10 25 50 75 90 { > * values of x variable (purely for graphing purposes) > > est use one > est esample: if sample == 1 > > di "$S_TIME" > > margins, eyex(relig) noestimcheck at( (p`i') relig (p`j') `var') vce(unconditional) post > matrix b = e(b) > matrix list b > matrix V = e(V) > matrix list V > > replace ME_`j' = b[1,1] if MV == `i' > replace VAR_`j' = V[1,1] if MV == `i' > replace SE_`j' = VAR_`j'^(0.5) if MV == `i' > > replace lower_`j' = ME_`j' - (2.58 * SE_`j') > replace upper_`j' = ME_`j' + (2.58 * SE_`j') > matrix drop b > matrix drop V > } > } > > *drop if MV > 85 > *drop if MV < 15 > > * all percentiles in one graph without CI > * idea: because we cannot show CIs in a graph with multipe lines, instead make each line fat when the effect is si > gnificant > graph twoway /// > (line ME_25 MV, clwidth(medium) lpattern(dash) clcolor(black)) /// > (line ME_50 MV, clwidth(medium) lpattern(solid) clcolor(black)) /// > (line ME_75 MV, clwidth(medium) lpattern(dot) clcolor(black)) /// > , legend(col(1) /// > label(1 "Marginal effect of religiosity at 25-percentile of aggregate acceptance") > /// > label(2 "Marginal effect of religiosity at 50-percentile of aggregate acceptance") > /// > label(3 "Marginal effect of religiosity at 75-percentile of aggregate acceptance") > ) /// > xtitle("percentiles of religiosity") > > graph export probit-religiosity-`var'-allpercentiles, as(emf) replace > > * one percentile per graph with CI > foreach j in 25 50 75 { > graph twoway /// > (rarea upper_`j' lower_`j' MV, pstyle(ci)) /// > (line ME_`j' MV, clcolor(black) clwidth(medium) lp(solid)) /// > , legend(order(1) label(1 "99% confidence interval")) /// > title("Marginal effect of religiosity at `j'-percentile of acceptance") // > / > xtitle("percentiles of religiosity") > > graph export probit-religiosity-`var'-`j'percentile, as(emf) replace > } > > restore > } > */ . /* > ** religiosity - binary discrete variables > > foreach var in male married unempl { > > preserve > cap set more off > gen MV = _n > replace MV = . if _n > 99 > > > foreach j in 0 1 { > * percentiles > gen ME_`j' = . > gen VAR_`j' = . > gen SE_`j' = . > gen lower_`j' = . > gen upper_`j' = . > > foreach i in 10 25 50 75 90 { > * values of x variable (purely for graphing purposes) > > est use one > est esample: if sample == 1 > > margins, eyex(relig) noestimcheck at( (p`i') relig `var'=`j') vce(unconditional) post > matrix b = e(b) > matrix V = e(V) > replace ME_`j' = b[1,1] if MV == `i' > > replace VAR_`j' = V[1,1] if MV == `i' > replace SE_`j' = VAR_`j'^(0.5) if MV == `i' > > replace lower_`j' = ME_`j' - (2.58 * SE_`j') > replace upper_`j' = ME_`j' + (2.58 * SE_`j') > matrix drop b > matrix drop V > } > } > > *drop if MV > 85 > *drop if MV < 15 > > * all percentiles in one graph without CI > graph twoway /// > (line ME_0 MV, clwidth(medium) clcolor(blue) clcolor(black)) /// > (line ME_1 MV, clwidth(medium) clcolor(blue) clcolor(black)) /// > , legend(col(1) /// > label(1 "Marginal effect of religiosity at `var' = 0") /// > label(2 "Marginal effect of religiosity at `var' = 1")) /// > xtitle("percentiles of religiosity") > > graph export probit-religiosity-`var'-dummies, as(emf) replace > > restore > } > > > ** religiosity - multiple response discrete variables > > sum income age satisf_fin educ, detail > > local income_p25 = 3 > local income_p50 = 4 > local income_p75 = 6 > > local age_p25 = 27 > local age_p50 = 38 > local age_p75 = 51 > > local satisf_fin_p25 = 4 > local satisf_fin_p50 = 5 > local satisf_fin_p75 = 8 > > local educ_p25 = 2 > local educ_p50 = 4 > local educ_p75 = 6 > > local list > > > foreach var in income age satisf_fin educ { > > preserve > cap set more off > gen MV = _n > replace MV = . if _n > 99 > > > foreach j in 25 50 75 { > * percentiles > gen ME_`j' = . > gen VAR_`j' = . > gen SE_`j' = . > gen lower_`j' = . > gen upper_`j' = . > > foreach i in 10 25 50 75 90 { > * values of x variable (purely for graphing purposes) > > est use one > est esample: if sample == 1 > > margins, eyex(relig) noestimcheck atmeans at( (p`i') relig `var'=`var_p`j'') vce(unconditional) po > st > matrix b = e(b) > matrix V = e(V) > replace ME_`j' = b[1,1] if MV == `i' > > replace VAR_`j' = V[1,1] if MV == `i' > replace SE_`j' = VAR_`j'^(0.5) if MV == `i' > > replace lower_`j' = ME_`j' - (2.58 * SE_`j') > replace upper_`j' = ME_`j' + (2.58 * SE_`j') > matrix drop b > matrix drop V > } > } > > *drop if MV > 85 > *drop if MV < 15 > > * all percentiles in one graph without CI > graph twoway /// > (line ME_25 MV, clwidth(medium) clcolor(blue) clcolor(black)) /// > (line ME_50 MV, clwidth(medium) clcolor(blue) clcolor(black)) /// > (line ME_75 MV, clwidth(medium) clcolor(blue) clcolor(black)) /// > , legend(col(1) /// > label(1 "Marginal effect of religiosity at 25-percentile of `var'") /// > label(2 "Marginal effect of religiosity at 50-percentile of `var'") /// > label(3 "Marginal effect of religiosity at 75-percentile of `var'")) /// > xtitle("percentiles of religiosity") > > graph export probit-religiosity-`var'-allpercentiles, as(emf) replace > > * one percentile per graph with CI > foreach j in 25 50 75 { > graph twoway /// > (rarea upper_`j' lower_`j' MV, pstyle(ci)) /// > (line ME_`j' MV, clwidth(medium) lp(solid)) /// > , legend(off) /// > title("Marginal effect of religiosity at `j'-percentile of `var'") /// > xtitle("percentiles of religiosity") > > graph export probit-religiosity-`var'-`j'percentile, as(emf) replace > } > > restore > } > */ . . . ** religiosity - denomination . preserve . cap set more off . gen MV = _n . replace MV = . if _n > 99 (164,110 real changes made, 164,110 to missing) . . foreach denom in 53 12 31 42 49 52 62 87 { 2. . gen ME_`denom' = . 3. gen VAR_`denom' = . 4. gen SE_`denom' = . 5. gen lower_`denom' = . 6. gen upper_`denom' = . 7. . foreach i in 10 25 50 75 90 { 8. . est use one 9. est esample: if sample == 1 10. . di "$S_TIME" 11. . margins, eyex(relig) noestimcheck at((p`i') relig denom=`denom') vce(unconditional) post 12. . matrix b = e(b) 13. matrix V = e(V) 14. . replace ME_`denom' = b[1,1] if MV == `i' 15. replace VAR_`denom' = V[1,1] if MV == `i' 16. replace SE_`denom' = VAR_`denom'^(0.5) if MV == `i' 17. . replace lower_`denom' = ME_`denom' - (2.58 * SE_`denom') 18. replace upper_`denom' = ME_`denom' + (2.58 * SE_`denom') 19. . matrix drop b 20. matrix drop V 21. } 22. } (164,209 missing values generated) (164,209 missing values generated) (164,209 missing values generated) (164,209 missing values generated) (164,209 missing values generated) file one.ster not found r(601); end of do-file r(601); . exit, clear