// Open ISSP 2005 use COUNTRY WRKHRS V51 using "ZA4350_v2-0-0.dta", clear // Prepare variables rename COUNTRY country // Job satisfaction generate jobsatis = 7 - V51 rename WRKHRS workhrs // Average working hours per country bys country: egen avghrs = mean(workhrs) // Center working hours center workhrs, inplace // Fit models eststo clear eststo: regress jobsatis workhrs avghrs // OLS regression eststo: mixed jobsatis workhrs avghrs || country: // RE regression qui matrix foo = e(N_g) // Number of individuals qui estadd scalar nc = foo[1,1] // Number of individuals // Prepare data for meta-regression preserve // Generate country-level data set of average working hours egen pickone = tag(country) keep if pickone keep country avghrs tempfile temp save `temp', replace restore // Average job satisfaction per country, controlling for individual working hours statsby _b[_cons] _se[_cons] e(N), clear by(country): regress jobsatis workhrs // Merge with average working hours merge 1:1 country using `temp' eststo: regress _stat_1 avghrs // OLS regression two-step eststo: vwls _stat_1 avghrs, sd(_stat_2) // FE meta-regression eststo: metareg _stat_1 avghrs, wsse(_stat_2) // RE meta-regression esttab, keep(main:) mtitles("OLS" "Multilevel" "OLS two-step" "FE meta-regression" "RE meta-regression") b(3) se(3) /// coeflabel(workhrs "Working hours" /// avghrs "Average working hours" /// _cons "Intercept") /// stats(nc N, labels("No. countries") fmt(%12.0gc %12.0gc)) varwidth(25) modelwidth(20) eqlabels("", none)
