* Stata do file name: '452note03_exercises_f13.txt' * * To execute (run) this do file, enter on the Stata command line the * command on the line below: * * do 452note03_exercises_f13.txt * * Open a text-format log file: log using 452note03_exercises_f13.log, replace version * * Input dataset is "wage1_econ452_males.dta" * Output dataset is "452note03_exercises_dataset.dta" in Stata 12 format * * Read input dataset "wage1_econ452_males.dta" into memory use wage1_econ452_males describe, short summarize * Generate polynomial terms in variable 'ed' generate edsq = ed*ed generate ed3rd = ed*ed*ed generate ed4th = ed*ed*ed*ed summarize ed edsq ed3rd ed4th * Generate polynomial terms in variable 'exp' generate expsq = exp*exp generate exp3rd = exp*exp*exp generate exp4th = exp*exp*exp*exp summarize exp expsq exp3rd exp4th * Generate interaction term between 'ed' and 'exp' generate edexp = ed*exp summarize edexp * * Estimate by OLS Model 3 in Note 3 for sample of 274 male employees in the U.S. in 1976 * * First, generate the natural log of the average hourly earnings variable 'wage' = lnw generate lnw = ln(wage) summarize wage lnw * Second, estimate Model 3 by OLS for 1976 sample of 274 male employees in U.S. regress lnw ed edsq ed3rd ed4th exp expsq exp3rd exp4th edexp * * Hypothesis Tests on the Marginal Effect of 'ed' on 'lnw' in Model 3 * * Test 1-ed: marginal effect of 'ed' is zero for all values of 'ed' and 'exp' test ed edsq ed3rd ed4th edexp return list * Test 2-ed: marginal effect of 'ed' is a constant, i.e., does not depend on 'ed' or 'exp' test edsq ed3rd ed4th edexp return list * Test 3-ed: marginal effect of 'ed' is unrelated to 'ed' test edsq ed3rd ed4th return list * Test 4-ed: 3rd degree polynomial in 'ed' is adequate for representing * conditional effect of 'ed' on 'lnw' test ed4th return list lincom _b[ed4th] return list display 2*ttail(r(df), abs(r(estimate)/r(se))) * Test 5-ed: 2nd degree polynomial in 'ed' is adequate for representing * conditional effect of 'ed' on 'lnw' test ed4th ed3rd return list * Test 6-ed: 1st degree polynomial in 'ed' is adequate for representing * conditional effect of 'ed' on 'lnw' test ed4th ed3rd edsq return list * Test 7-ed: a zero degree polynomial in 'ed' is adequate for representing * conditional effect of 'ed' on 'lnw' test ed4th ed3rd edsq ed return list * * Hypothesis Tests on the Marginal Effect of 'exp' on 'lnw' in Model 3 * * Test 1-exp: marginal effect of 'exp' is zero for all values of 'exp' and 'ed' test exp expsq exp3rd exp4th edexp return list * Test 2-exp: marginal effect of 'exp' is a constant, i.e., does not depend on 'exp' or 'ed' test expsq exp3rd exp4th edexp return list * Test 3-exp: marginal effect of 'exp' is unrelated to 'exp' test expsq exp3rd exp4th return list * Test 4-exp: 3rd degree polynomial in 'exp' is adequate for representing * conditional effect of 'exp' on 'lnw' test exp4th return list lincom _b[exp4th] return list display 2*ttail(r(df), abs(r(estimate)/r(se))) * Test 5-exp: 2nd degree polynomial in 'exp' is adequate for representing * conditional effect of 'exp' on 'lnw' test exp3rd exp4th return list * Test 6-exp: 1st degree polynomial in 'exp' is adequate for representing * conditional effect of 'exp' on 'lnw' test expsq exp3rd exp4th return list * Test 7-exp: a zero degree polynomial in 'exp' is adequate for representing * conditional effect of 'exp' on 'lnw' test exp expsq exp3rd exp4th return list * * Hypothesis Test on the Interaction Effect Between 'ed' and 'exp' in Model 3 * * Test 8: marginal effect of 'ed' is unrelated to 'exp' and * marginal effect of 'exp' is unrelated to 'ed' test edexp return list lincom _b[edexp] return list display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Use 'lincom' command to compute estimates of the marginal effect of 'ed' * on 'lnw' for the median value of 'exp' and ed = 8, 10, 12, 14, 16 * * First, compute and save the median value of 'exp' * summarize exp, detail return list scalar exp50p = r(p50) scalar list exp50p * * Second, compute marginal effect of 'ed' for ed = 8, 10, 12, 14, 16 & exp = exp50p, * and perform a two-tail test that this marginal effect of 'ed' equals zero. * lincom _b[ed] + 2*_b[edsq]*8 + 3*_b[ed3rd]*8*8 + 4*_b[ed4th]*8*8*8 + _b[edexp]*exp50p lincom _b[ed] + 2*_b[edsq]*10 + 3*_b[ed3rd]*10*10 + 4*_b[ed4th]*10*10*10 + _b[edexp]*exp50p lincom _b[ed] + 2*_b[edsq]*12 + 3*_b[ed3rd]*12*12 + 4*_b[ed4th]*12*12*12 + _b[edexp]*exp50p lincom _b[ed] + 2*_b[edsq]*14 + 3*_b[ed3rd]*14*14 + 4*_b[ed4th]*14*14*14 + _b[edexp]*exp50p lincom _b[ed] + 2*_b[edsq]*16 + 3*_b[ed3rd]*16*16 + 4*_b[ed4th]*16*16*16 + _b[edexp]*exp50p * * Use 'lincom' command to compute estimates of the marginal effect of 'exp' on 'lnw' * for the median value of 'ed' and * the 10th, 25th, 50th, 75th, and 90th sample percentile values 'exp' * * First, compute and save the median value of 'ed' * summarize ed, detail return list scalar ed50p = r(p50) scalar list ed50p * * Second, compute and save the 10th, 25th, 75th, and 90th sample percentile * values median value of 'exp' * summarize exp, detail return list scalar exp10p = r(p10) scalar exp25p = r(p25) scalar exp75p = r(p75) scalar exp90p = r(p90) scalar list exp10p exp25p exp50p exp75p exp90p * * Third, compute marginal effect of 'exp' for ed = ed50p & * exp = 10th, 25th, 50th, 75th, and 90th sample percentile values * and perform a two-tail test that this marginal effect of 'exp' equals zero. * lincom _b[exp] + 2*_b[expsq]*exp10p + 3*_b[exp3rd]*exp10p*exp10p + 4*_b[exp4th]*exp10p*exp10p*exp10p + _b[edexp]*ed50p lincom _b[exp] + 2*_b[expsq]*exp25p + 3*_b[exp3rd]*exp25p*exp25p + 4*_b[exp4th]*exp25p*exp25p*exp25p + _b[edexp]*ed50p lincom _b[exp] + 2*_b[expsq]*exp50p + 3*_b[exp3rd]*exp50p*exp50p + 4*_b[exp4th]*exp50p*exp50p*exp50p + _b[edexp]*ed50p lincom _b[exp] + 2*_b[expsq]*exp75p + 3*_b[exp3rd]*exp75p*exp75p + 4*_b[exp4th]*exp75p*exp75p*exp75p + _b[edexp]*ed50p lincom _b[exp] + 2*_b[expsq]*exp90p + 3*_b[exp3rd]*exp90p*exp90p + 4*_b[exp4th]*exp90p*exp90p*exp90p + _b[edexp]*ed50p * * Test 9: Jointly test the set of 6 potential simplifying coefficient restrictions on Model 3 * for male employees implied by the previous hypothesis tests on Model 3 * test edsq ed3rd ed4th exp3rd exp4th edexp return list * * OLS estimation of simplified regression model that imposes the foregoing * 6 exclusion restrictions on Model 3 * regress lnw ed exp expsq * * In the restricted (simplified) version of Model 3, compute the marginal effect of 'exp' * for exp = 10th, 25th, 50th, 75th, and 90th sample percentile values, * and perform a two-tail test that each marginal effect of 'exp' equals zero. * lincom _b[exp] + 2*_b[expsq]*exp10p lincom _b[exp] + 2*_b[expsq]*exp25p lincom _b[exp] + 2*_b[expsq]*exp50p lincom _b[exp] + 2*_b[expsq]*exp75p lincom _b[exp] + 2*_b[expsq]*exp90p * * * Save in Stata 12 format the current dataset in memory as '452note03_exercises_dataset-Stata12.dta' * saveold 452note03_exercises_dataset-Stata12.dta, replace describe, short summarize * * End job: close log file and clear dataset from memory * dir 452note03*.* log close clear