version 12.1 * Problem 2. Quality of Employment survey. use https://www3.nd.edu/~rwilliam/statafiles/jqges2.dta, clear * Tidy up the data for our purposes keep jsat prof mang tenure firmsize hrswk race * Compute "Good job" variable (professional or managerial). gen goodjob=prof+mang * Compute dummy variable for white/ nonwhite. recode race (1=1) (else=0), gen(white) * hrswk (hours work per week) seems to be off by factor of 10, * so correct. replace hrswk = hrswk/10. label define gdjob 0 "Other" 1 "Prof, Manager" label values goodjob goodjob label define white 0 "NonWhite" 1 "White" label values white white * Limit to cases with complete data keep if !missing(jsat, goodjob, tenure, firmsize, hrswk, white) * Compute race interaction terms. gen tenurewh=tenure*white gen firmszwh=firmsize*white gen goodjobwh=goodjob*white gen hrswkwh=hrswk*white * Regressions, set 1. Mean job satisfaction difference between groups. reg jsat white * Regressions, set 2. Test for any differences between groups. nestreg: reg jsat (goodjob tenure firmsize hrswk) (white goodjobwh tenurewh firmszwh hrswkwh) * Regressions, set 3. More detailed tests for differences in effects. nestreg: reg jsat (goodjob tenure firmsize hrswk) (white) (goodjobwh tenurewh firmszwh hrswkwh) * t-tests for compositional differences ttest goodjob, by(white) ttest tenure, by(white) ttest firmsize, by(white) ttest hrswk, by(white) ttest jsat, by(white)