Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pause on
- ********************** Regressions ***********************
- * If you haven't yet installed estout on your machine, you need to do that.
- ssc install estout
- pause Note that the regressions will be put in $DataOUT
- * DO YOU WANT TO RUN ALL 60 COMBINATIONS WITHOUT PAUSING?
- display _request(cheat_yn)
- * If so, then uncomment the relevant code in the .do file.
- if "$cheat_yn" != "yes" {
- /* Great! You're now at the end of the .do file! I'm going to ask you to type
- in answers to some questions, to determine what variables you want to work
- with. Just type in your answer in the command field, and press enter. */
- * 1. Please enter a dependent variable out of searches, encouraged, employed or participates
- display _request(dep)
- * 2. Grant X female recipient interaction? Enter yes or no.
- display _request(gXf_yn)
- * 3. Grant X matric interaction? Enter yes or no.
- display _request(gXmat)
- * 4. Dummy for grant or income? Enter dummy or income. (Note that the sample with dummy includes households with no grant income whereas the sample with the income variable only includes households with a positive grant income.)
- display _request(grantd)
- * 5. Separate out grant into different types? Enter yes or no.
- display _request(separate)
- }
- /*
- if "$cheat_yn" == "yes" {
- pause off
- foreach dependent in employed participates encouraged searches {
- global dep = "`dependent'"
- foreach f in no yes {
- global gXf_yn = "`f'"
- foreach d in income dummy {
- global grantd = "`d'"
- foreach s in no yes {
- global separate = "`s'"
- foreach m in yes no {
- global gXmat = "`m'"
- if ( "`dependent'" != "searches" & "`dependent'" != "encouraged" ) | "`f'" != "yes" | "`d'" != "dummy" | "`s'" != "yes" {
- * The previous line removes a few regressions that don't run properly
- * uncomment the closing brackets at the bottom */
- * This local variable needs to be run at the same time as the following regressions!
- if "$grantd" == "income" {
- local is = ""
- global thousands = "Note that the income variables are measured in thousands."
- }
- else if "$grantd" == "dummy" {
- local is = "is"
- global thousands = ""
- }
- else global grantd = "You_didn't_type_income_or_dummy_properly"
- /* The following regressions are run using this idea:
- global test = "w4_hhincome w4_best_gen w4_best_race `is'hhgrant"
- global test2 = ""
- display "reg $test $test2 , robust"
- reg $test $test2 , robust
- */
- if "$separate" == "no" {
- global grant = "`is'hhgovt"
- }
- else if "$separate" == "yes" {
- global grant = "`is'hhspen `is'hhdis `is'hhchld `is'hhcdep `is'hhfost"
- }
- else global grant = "You_didn't_type_yes_or_no_for_the_question_about_separating_out_the_grant_variable_properly."
- if "$gXmat" == "no" {
- global gXsecondary = ""
- }
- else if "$gXmat" == "yes" {
- if "$separate" == "no" {
- global gXsecondary = "`is'hhgovtXsecondary"
- }
- else if "$separate" == "yes" {
- global gXsecondary = "`is'hhspenXsecondary `is'hhdisXsecondary `is'hhchldXsecondary `is'hhcdepXsecondary `is'hhfostXsecondary"
- }
- }
- else global gXsecondary = "You_didn't_type_yes_or_no_for_the_matric_interaction_properly"
- if "$gXf_yn" == "no"{
- global gXfinter = ""
- }
- else if "$gXf_yn" == "yes" {
- if "$separate" == "no" {
- global gXfinter = "`is'hhgovtXfemalerecip"
- }
- else if "$separate" == "yes" {
- global gXfinter = "`is'hhspenXfemalerecip `is'hhdisXfemalerecip `is'hhchldXfemalerecip `is'hhcdepXfemalerecip `is'hhfostXfemalerecip"
- }
- }
- else global gXfinter = "You_didn't_type_yes_or_no_for_the_female_interaction_properly"
- display "The options you chose were: Dependent variable: $dep . Grant X female interaction: $gXf_yn . Grant X matric interaction: $gXmat . Dummy or HH income: $grantd . Grant separated out into different types: $separate ."
- display "reg $dep $grant $gXfinter $gXsecondary hhincomeminusgovt female childrenXfemale age age2 primary secondary tertiary married marriedXfemale [pweight=w4_wgt], robust "
- eststo, title(LPM): reg $dep $grant $gXfinter $gXsecondary hhincomeminusgovt female childrenXfemale age age2 primary secondary tertiary married marriedXfemale [pweight=w4_wgt], robust
- display "$thousands"
- eststo, title(Probit): probit $dep $grant $gXfinter $gXsecondary hhincomeminusgovt female childrenXfemale age age2 primary secondary tertiary married marriedXfemale [pweight=w4_wgt]
- eststo, title(Probit partial effects): margins, dydx( $grant $gXfinter $gXsecondary hhincomeminusgovt female childrenXfemale age age2 primary secondary tertiary married marriedXfemale) post // can also use -dprobit-. This is the marginal (or partial) effects.
- esttab using "$DataOUT\ $dep $grantd different=$separate gXfem=$gXf_yn gXsecon=$gXmat.rtf", title(Regressions of grant $grantd on $dep) label replace margin eqlabels(none) mtitles se r2
- eststo clear
- /*
- * This code is needed for the cheat loop
- }
- }
- }
- }
- }
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment