capture log close //uncomment below if you need to install analysis packages *ssc install gologit2 \\use version from http://fmwww.bc.edu/RePEc/bocode/g *findit estout *findit coefplot ******************************************************************** * * File-Name: Disconnect_replication_dofile_180302.do * Revised: 18/03/28 * Date: 17/08/16 * Author: * Purpose: This file recreates analyses and figures for SBM Citizen Disconnect book. * #1. Macros * #2. Chapter 4: * Fig 4.2: Govt has helped me IV: #vis-means, favors welfare, TabA4.1 in appendix * TabA4.1: Appendix for Fig4.2 and Fig4.3 * Fig 4.3: People like me IV: #sub-means, party, favors welfare (6), income, education * Fig 4.4: Probability of Figavoring Welfare by race, over income (6) * TabA4.2: Appendix for Fig4.3 and 4.4 * TabA4.3: Appendix for Fig4.5 and Fig4.6 * TabA5.2: Appendix for Fig5.7 and Fig5.8 * Fig 4.5: Pr(help) Pr(opps) by eitc/tanf, over income(5) * Fig 4.6: Pr(publcoff) Pr(nosay) by eitc/tanf, over income(5) * TabA4.4: Appendix for Fig 4.8 * Fig 4.8: Pr(opps) by higher ed policy * #3. Chapter 5 * TabA5.1: Appendix for Fig 5.2 and Fig 5.3 * Fig 5.2: Pr(spendsumid) by #vis-mean, #vis-nonmean, party, welfarefavors * Fig 5.3: Pr(healthax) by #vis-mean, party, favors welfare * TabA5.2: Appendix for Fig 5.7 and 5.8 * Fig 5.7: Pr(Register) by eitc/tanf, over income (5) * Fig 5.8: Voting behavior by eitc/tanf, over income 5 * DataUsed: Disconnect_replication_data_180327.dta * OutputFile: * DataOutput: * Machine: Stata 15 * ******************************************************************** clear all macro drop _all program drop _all set linesize 80 set more off *pause on *#delimit ; *#delimit cr //load data and check descriptive stats (univar or sum, etc.) use Disconnect_replication_data_180327.dta, clear svyset [pweight=weightfinal] ********** * #1. * Add/change variables and set macros ********** //MACROS global control age2 i.nonwhite i.hispanic i.male i.educat3 income6 partysum3 wlfrfv global control2 income5 partysum3 age2 c.age2#c.age2 i.nonwhite i.hispanic i.male i.educat3 global control3 age2 i.nonwhite i.hispanic i.male i.collgrad income6 partysum3 wlfrfv global pol1 vismean submean visnon subnon global pol2 eitcrcd wlfrrc *********** *#2. Chapter 4: * Fig 4.2: Govt has helped me IV: #vis-means, favors welfare, TabA4.1 in appendix * TabA4.1: Appendix for Fig4.2 and Fig4.3 * Fig 4.3: People like me IV: #sub-means, party, favors welfare (6), income, education * Fig 4.4: Probability of Figavoring Welfare by race, over income (6) * TabA4.2: Appendix for Fig4.3 and 4.4 * TabA4.3: Appendix for Fig4.5 and Fig4.6 * TabA5.2: Appendix for Fig5.7 and Fig5.8 * Fig 4.5: Pr(help) Pr(opps) by eitc/tanf, over income(5) * Fig 4.6: Pr(publcoff) Pr(nosay) by eitc/tanf, over income(5) * TabA4.4: Appendix for Fig 4.8 * Fig 4.8: Pr(opps) by higher ed policy ************ //Fig4.2 & TabA4.1 eststo modela: svy: logit wlfrfv2 i.educat i.income6 i.male i.raceeth i.hispanic, nolog margins 1.raceeth 2.raceeth, at(income6=(0(1)5)) vce(uncond) post marginsplot, name(g1) title("") xtitle("Income") ytitle("Pr(Favors Welfare)") scheme(s1mono) xlabel(0 `""Under" "$20,000""' 1 `""$20,000" "to $34,999""' 2 `""$35,000" "to $49,999""' 3 `""$50,000" "to $74,999""' 4 `""$75,000" "to $99,999""' 5 `""$100,000" "or More""', labsize(small)) esttab modela, nobase se label title("Table A4.1") eststo clear graph drop _all //Fig4.3 svy: logit Igovthelp $control $pol1, nolog margins, at(vismean=(0(1)7)) vce(uncond) marginsplot, name(g1) title("Number of Visible Means-Tested" "Programs Used") xtitle("Number of Programs Ever Used") ytitle("Probability of Agreeing") nolabel scheme(s1mono) margins, at(wlfrfv=(1(1)4)) vce(uncond) marginsplot, name(g2) title(" " "Favors Welfare") xtitle("1 = Very Unfavorable") ytitle("") nolabel scheme(s1mono) graph combine g1 g2, ycommon scheme(s1mono) graph drop _all //Fig4.4 svy: logit Inosay $control $pol1, nolog margins, at(submean=(0(1)2)) vce(uncond) marginsplot, name(g1) title("Number of Submerged Means-Tested" "Programs Used") xtitle("Number of Programs Ever Used") ytitle("") nolabel scheme(s1mono) margins, at(partysum3=(1(1)5)) vce(uncond) marginsplot, name(g2) title(" " "Party Identification") xtitle("1 = Republican") ytitle("") nolabel scheme(s1mono) graph combine g1 g2, iscale(1) graphr(margin(zero)) name(gr12) ycommon margins, at(wlfrfv=(1(1)4)) vce(uncond) marginsplot, name(g3) title(" " "Favors Welfare") xtitle("1 = Very Unfavorable") ytitle("") nolabel scheme(s1mono) margins, at(income==(0(1)5)) vce(uncond) marginsplot, name(g4) title(" " "Income Level") xtitle("") xlabel(0 `""Less than" "$20,000""' 1 " " 2 " " 3 " " 4 " " 5 `""$100,000" "or More""') ytitle("") nolabel scheme(s1mono) graph combine g3 g4, iscale(1) graphr(margin(zero)) name(gr34) ycommon margins, at(educat3==(0(1)2)) vce(uncond) marginsplot, name(g5) title(" " "Education Level") xtitle("") xlabel(0 "High School or Less" 1 "Some College" 2 "BA Degree or Higher") ytitle("") nolabel scheme(s1mono) fxsize(60) graph combine gr12 gr34 g5, col(1) ycommon l2title("Probability of Agreeing") scheme(s1mono) graph drop _all eststo clear //TabA4.2 (appendix table for Fig4.3 and Fig4.4) local dv Igovthelp Igovtopps Ipublcoff Inosay Ifullcitz Idemocrac local i=1 foreach k of local dv { svy: logit `k' $control $pol1, nolog eststo model`i' svy: logit `k' $control $pol1, nolog margins, dydx(*) post eststo model`i'a local ++i } esttab model1 model1a model2 model2a model3 model3a model4 model4a model5 model5a model6 model6a, /// nobase label title("Table A4.2 Part 1 of 3") eststo clear gsvy: gologit2 fairtax1 $control $pol1, autofit(.01) store(gologitauto) esttab gologitauto, nobase se label title("Table A4.2 Part 2 of 3") esttab gologitauto, nobase eform ci(a3) label title("Table A4.2 Part 3 of 3") eststo clear //Tab A4.3 for Fig4.5 & Fig4.6 svy: qui logit Igovthelp i.eitctanf $control2 i.felony eststo model1: margins, dydx(*) post svy: qui logit Igovthelp i.eitctanf $control2 i.felony margins eitctanf,at(income5=(0(1)3)) vce(uncond) post matrix D1=e(b) svy: qui logit Igovtopps i.eitctanf $control2 i.felony eststo model2: margins, dydx(*) post svy: qui logit Igovtopps i.eitctanf $control2 i.felony margins eitctanf,at(income5=(0(1)3)) vce(uncond) post matrix D2=e(b) svy: qui logit Ipublcoff i.eitctanf $control2 i.felony eststo model3: margins, dydx(*) post svy: qui logit Ipublcoff i.eitctanf $control2 i.felony margins eitctanf,at(income5=(0(1)3)) vce(uncond) post matrix D3=e(b) svy: qui logit Inosay i.eitctanf $control2 i.felony eststo model4: margins, dydx(*) post svy: qui logit Inosay i.eitctanf $control2 i.felony margins eitctanf,at(income5=(0(1)3)) vce(uncond) post matrix D4=e(b) gsvy: gologit2 fairtax1 i.eitctanf $control2 i.felony, autofit(.01) store(gologitauto) //Tab A5.2 for Fig5.7 & Fig5.8 svy: qui logit regvote1 i.eitctanf $control2 i.felony eststo model5: margins, dydx(*) post svy: qui logit regvote1 i.eitctanf $control2 i.felony margins eitctanf,at(income5=(0(1)3)) vce(uncond) post matrix D5=e(b) svy: reg votenonp1 i.eitctanf $control2 i.felony eststo model6: margins, dydx(*) post svy: reg votenonp1 i.eitctanf $control2 i.felony margins eitctanf,at(income5=(0(1)3)) vce(uncond) post matrix D6=e(b) svy: reg votepres1 i.eitctanf $control2 i.felony eststo model7: margins, dydx(*) post svy: poisson sumpartic i.eitctanf $control2 i.felony, irr eststo model8 //for pasting into excel and formatting for book esttab model1 model2 model3 model4, nobase se label title("Table A4.3 Part 1 of 2") esttab gologitauto, nobase eform ci(a3) label title("Table A4.3 Part 2 of 2") esttab model5 model7 model6, nobase se label title("Table A5.2 Part 1 of 2") esttab model8, nobase eform ci(a3) label title("Table A5.2 Part 2 of 2") eststo clear //Fig4.5 Fig4.6 Fig5.7 Fig5.8 //put all the probabilities into matrixes to graph in excel //in excel, remove the predicted values when income levels above 34K forvalues k=1/6 { matrix M`k'=J(4,4,-99) matrix colnames M`k' = Neither EITC Welfare Both matrix M`k'[1,1]=D`k'[1,1] matrix M`k'[2,1]=D`k'[1,5] matrix M`k'[3,1]=D`k'[1,9] matrix M`k'[4,1]=D`k'[1,13] matrix M`k'[1,2]=D`k'[1,2] matrix M`k'[2,2]=D`k'[1,6] matrix M`k'[3,2]=D`k'[1,10] matrix M`k'[4,2]=D`k'[1,14] matrix M`k'[1,3]=D`k'[1,3] matrix M`k'[2,3]=D`k'[1,7] matrix M`k'[3,3]=D`k'[1,11] matrix M`k'[4,3]=D`k'[1,15] matrix M`k'[1,4]=D`k'[1,4] matrix M`k'[2,4]=D`k'[1,8] matrix M`k'[3,4]=D`k'[1,12] matrix M`k'[4,4]=D`k'[1,16] } matrix list M1 matrix list M2 matrix list M3 matrix list M4 matrix list M5 matrix list M6 //Tab A4.4 local educ giblrcd pellrc stlnrcd hopercd q529rcd local i=1 foreach k of local educ { svy: logit Igovtopps `k' $control3 if sample==1, nolog eststo model`i' svy: logit Igovtopps `k' $control3 if sample==1, nolog margins, dydx(*) post vce(uncond) eststo model`i'a local ++i } svy: logit Igovtopps pellrc stlnrcd $control3 if sample==1, nolog eststo model6 svy: logit Igovtopps pellrc stlnrcd $control3 if sample==1, nolog margins, dydx(*) post vce(uncond) eststo model6a esttab model1 model1a model2 model2a model3 model3a model4 model4a model5 model5a model6 model6a, nobase se label title("Table A4.4") order(giblrcd pellrc stlnrcd hopercd q529rcd) //Fig4.8 coefplot (model1, label(GIBill)) (model2, label(Pell)) (model3, label(Student Loans)) /// (model4, label(Hope Credit)) (model5, label(529 Plan)) , /// keep(giblrcd pellrc stlnrcd hopercd q529rcd) xline(0) scheme(s1mono) /// rename(giblrcd="GI Bill" pellrc="Pell Grants" stlnrcd="Student Loans" hopercd="Hope Credit" q529rcd="529 Plan") /// legend(off) eststo clear graph drop _all *********** *#3. Chapter 5 * TabA5.1: Appendix for Fig 5.2 and Fig 5.3 * Fig 5.2: Pr(spendsumid) by #vis-mean, #vis-nonmean, party, welfarefavors * Fig 5.3: Pr(healthax) by #vis-mean, party, favors welfare * TabA5.2: Appendix for Fig 5.7 and 5.8 * Fig 5.7: Pr(Register) by eitc/tanf, over income (5) * Fig 5.8: Voting behavior by eitc/tanf, over income 5 *********** //Tab A5.1--appendix for Fig5.2 //copy results individually into same table gsvy: gologit2 spendsumidpos $control $pol1, autofit(.01) store(gologitauto) esttab gologitauto, nobase se label title("Table A5.1 Part 1 of 3") esttab gologitauto, nobase eform ci(a3) label title("Table A5.1 Part 2 of 3") //Fig 5.2 margins, at(vismean=(0(1)4)) vce(uncond) marginsplot, name(g1) nolabel scheme(s1mono) graph(_outcome, label("1" "2" "")) margins, at(visnon=(0(1)3)) vce(uncond) marginsplot, name(g2) nolabel scheme(s1mono) graph(_outcome, label("1" "2" "")) margins, at(partysum3=(1(1)5)) vce(uncond) marginsplot, name(g3) nolabel scheme(s1mono) graph(_outcome, label("1" "2" "")) margins, at(wlfrfv=(1(1)4)) vce(uncond) marginsplot, name(g4) nolabel scheme(s1mono) graph(_outcome, label("1" "2" "")) //open graphs in graphics editor and modify individually graph combine g13 g23 g33 g43, ycommon scheme(s1mono) graph drop _all eststo clear //Tab A5.1 cont'd--appendix for Fig5.3 eststo model2: svy: logit healthax2 $control $pol1, nolog svy: logit healthax2 $control $pol1, nolog eststo model2a: margins, dydx(*) post esttab model2 model2a, nobase label title("Table A5.1 Part 3 of 3") eststo clear //Fig 5.3 svy: logit healthax2 $control $pol1, nolog margins, at(vismean=(0(1)7)) vce(uncond) marginsplot, name(g1) title("Number of Visible Means-Tested Policies") xtitle("Number of Programs Ever Used") ytitle("") nolabel scheme(s1mono) margins, at(partysum3=(1(1)5)) vce(uncond) marginsplot, name(g2) title("Party Identification") xtitle("1 = Republican") ytitle("") nolabel scheme(s1mono) margins, at(wlfrfv=(1(1)4)) vce(uncond) marginsplot, name(g3) title("Favors Welfare") xtitle("1 = Very Unfavorable") ytitle("") nolabel scheme(s1mono) graph combine g1 g2 g3, ycommon scheme(s1mono) l2title("Probability of Agreeing") graph drop _all eststo clear //Tab A5.2--appendix for Fig5.7 and Fig5.8 **SEE ABOVE AT FIG 4.5 AND 4.6 //Fig 5.7 & Fig5.8--done in excel with analysis **SEE ABOVE AT FIG 4.5 AND 4.6 exit