* NOTE: The first line of any Stata do file should contain a 'log using' command * to open/start a text-format Stata log file where all the results of the Stata commands * in this do file are recorded. * log using 452note08_stata11_exercise1_f11.log, replace version set more off * To have Stata execute this do file, enter the following Stata command * on the Stata command line: * * do 452note08_stata11_exercise1_f11.txt * * Do file: 452note08_stata11_exercise1_f11.txt * Log file: 452note08_stata11_exercise1_f11.log * * Input dataset: wage1_econ452_stata11.dta * Output dataset: wage1_econ452_stata11.dta (re-saved) * * Read input dataset 'wage1_econ452_stata11.dta' into memory use wage1_econ452_stata11, clear describe, short describe summarize * Check gender indicators 'f' and 'm' tab1 f m, missing tab2 f m, missing * Check industry dummy variables * tab1 industry, missing tab2 industry ind1, missing col tab2 industry ind2, missing col tab2 industry ind3, missing col tab2 industry ind4, missing col tab2 industry ind5, missing col tab2 industry ind6, missing col tab2 industry ind7, missing col * Generate Female Interactions with All Other Regressors in Model 5.5 * generate fed = f*ed generate fexp = f*exp generate fedsq = f*edsq generate fexpsq = f*expsq generate fedexp = f*edexp generate find1 = f*ind1 generate find2 = f*ind2 generate find3 = f*ind3 generate find4 = f*ind4 generate find5 = f*ind5 generate find6 = f*ind6 generate find7 = f*ind7 summarize fed fexp fedsq fexpsq fedexp find1 find2 find3 find4 find5 find6 find7 * * Note 8 -- Model 5.5: Gender base group = males * Industry base group = industry 1 (ind1) * * Below we use '#delimit' to enable us to put a single Stata command on more than one line. * #delimit ; regress lnw ed exp edsq expsq edexp ind2 ind3 ind4 ind5 ind6 ind7 f fed fexp fedsq fexpsq fedexp find2 find3 find4 find5 find6 find7 ; #delimit cr * Model 5.5: Compute the female coefficient estimates lincom _b[_cons] + _b[f] lincom _b[ed] + _b[fed] lincom _b[exp] + _b[fexp] lincom _b[edsq] + _b[fedsq] lincom _b[expsq] + _b[fexpsq] lincom _b[edexp] + _b[fedexp] lincom _b[ind2] + _b[find2] lincom _b[ind3] + _b[find3] lincom _b[ind4] + _b[find4] lincom _b[ind5] + _b[find5] lincom _b[ind6] + _b[find6] lincom _b[ind7] + _b[find7] * Model 5.5: Display the male coefficient estimates lincom _b[_cons] lincom _b[ed] lincom _b[exp] lincom _b[edsq] lincom _b[expsq] lincom _b[edexp] lincom _b[ind2] lincom _b[ind3] lincom _b[ind4] lincom _b[ind5] lincom _b[ind6] lincom _b[ind7] * Model 5.5: Display the female-male coefficient differences lincom _b[f] lincom _b[fed] lincom _b[fexp] lincom _b[fedsq] lincom _b[fexpsq] lincom _b[fedexp] lincom _b[find2] lincom _b[find3] lincom _b[find4] lincom _b[find5] lincom _b[find6] lincom _b[find7] * * Model 5.5: Tests on marginal effect of ed for Males * Test 1m: ME of ed for males is zero for all values of ed & exp test ed edsq edexp return list * Test 2m: ME of ed for males is constant test edsq edexp return list * Test 3m: ME of ed for males is unrelated to ed test edsq test edsq = 0 return list lincom _b[edsq] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Test 4m: ME of ed for males is unrelated to exp test edexp test edexp = 0 return list lincom _b[edexp] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Tests on marginal effect of ed for Females * Test 1f: ME of ed for females is zero for all values of ed & exp test ed + fed = 0, notest test edsq + fedsq = 0, accumulate notest test edexp + fedexp = 0, accumulate return list * Test 2f: ME of ed for females is constant test edsq + fedsq = 0, notest test edexp + fedexp = 0, accumulate return list * Test 3f: ME of ed for females is unrelated to ed test edsq + fedsq = 0 return list lincom _b[edsq] + _b[fedsq] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Test 4f: ME of ed for females is unrelated to exp test edexp + fedexp = 0 return list lincom _b[edexp] + _b[fedexp] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Tests on Female-Male differences in marginal effect of ed * Test 5: Female-Male difference in ME of ed is zero for all values of ed & exp test fed fedsq fedexp return list * Test 6: Female-Male difference in ME of ed is a constant * Female-Male difference in ME of ed is unrelated to ed & exp test fedsq fedexp return list * Test 7: Female-Male difference in ME of ed is unrelated to ed test fedsq test fedsq = 0 return list lincom _b[fedsq] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Test 8: Female-Male difference in ME of ed is unrelated to exp test fedexp test fedexp = 0 return list lincom _b[fedexp] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Tests of Industry Effects * * Test 1-Industry: Test of industry effects for Males test ind2 ind3 ind4 ind5 ind6 ind7 return list * Test 2-Industry: Test of industry effects for Females test ind2 + find2 = 0, notest test ind3 + find3 = 0, notest accumulate test ind4 + find4 = 0, notest accumulate test ind5 + find5 = 0, notest accumulate test ind6 + find6 = 0, notest accumulate test ind7 + find7 = 0, accumulate return list * Test 3-Industry: Test of Female-Male differences in industry effects test find2 find3 find4 find5 find6 find7 return list * * Model 5.5: Tests for Female-Male Differences in Conditional Mean lnw * * Test 1: Female-Male Difference in Conditional Mean lnw Equals Zero test f fed fexp fedsq fexpsq fedexp find2 find3 find4 find5 find6 find7 return list * Test 2: Female-Male Difference in Conditional Mean lnw Equals a Constant test fed fexp fedsq fexpsq fedexp find2 find3 find4 find5 find6 find7 return list * Test 3: Female-Male Difference in Conditional Mean lnw Unrelated to ed test fed fedsq fedexp return list * Test 4: Female-Male Difference in Conditional Mean lnw Unrelated to exp test fexp fexpsq fedexp return list * Test 5: Female-Male Difference in Conditional Mean lnw Unrelated to Industry test find2 find3 find4 find5 find6 find7 return list * * Model 5.5: Evaluating the Marginal Effect of ed at Median Values of ed & exp * summarize ed, detail return list scalar edmed = r(p50) summarize exp, detail return list scalar expmed = r(p50) scalar list edmed expmed * * Model 5.5: Evaluate Marginal Effect of ed for Males * at Median Values of ed & exp lincom _b[ed] + 2*_b[edsq]*edmed + _b[edexp]*expmed return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Evaluate Marginal Effect of ed for Females * at Median Values of ed & exp lincom (_b[ed] + _b[fed]) + 2*(_b[edsq] + _b[fedsq])*edmed + (_b[edexp] + _b[fedexp])*expmed return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Evaluate Female-Male Difference in Marginal Effect of ed * at Median Values of ed & exp lincom _b[fed] + 2*_b[fedsq]*edmed + _b[fedexp]*expmed return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Evaluating Conditional Effect of Industry * at Median Values of ed & exp * * Model 5.5: Conditional Effect of Industry for Females * * Model 5.5: Conditional Mean lnw for Females in Industry 1 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Females in Industry 2 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed + (_b[ind2] + _b[find2]) ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Females in Industry 3 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed + (_b[ind3] + _b[find3]) ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Females in Industry 4 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed + (_b[ind4] + _b[find4]) ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Females in Industry 5 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed + (_b[ind5] + _b[find5]) ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Females in Industry 6 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed + (_b[ind6] + _b[find6]) ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Females in Industry 7 * at Median Values of ed & exp #delimit ; lincom _b[_cons] + _b[f] + (_b[ed] + _b[fed])*edmed + (_b[exp] + _b[fexp])*expmed + (_b[edsq] + _b[fedsq])*edmed*edmed + (_b[expsq] + _b[fexpsq])*expmed*expmed + (_b[edexp] + _b[fedexp])*edmed*expmed + (_b[ind7] + _b[find7]) ; #delimit cr return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Model 5.5: Conditional Effect of Industry for Males * * Model 5.5: Conditional Mean lnw for Males in Industry 1 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Males in Industry 2 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed + _b[ind2] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Males in Industry 3 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed + _b[ind3] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Males in Industry 4 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed + _b[ind4] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Males in Industry 5 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed + _b[ind5] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Males in Industry 6 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed + _b[ind6] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Conditional Mean lnw for Males in Industry 7 * at Median Values of ed & exp lincom _b[_cons] + _b[ed]*edmed + _b[exp]*expmed + _b[edsq]*edmed*edmed + _b[expsq]*expmed*expmed + _b[edexp]*edmed*expmed + _b[ind7] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Model 5.5: Female-Male Differences in Conditional Effect of Industry * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 1 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 2 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed + _b[find2] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 3 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed + _b[find3] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 4 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed + _b[find4] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 5 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed + _b[find5] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 6 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed + _b[find6] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Model 5.5: Female-Male Difference in Conditional Mean lnw for Industry 7 * at Median Values of ed & exp lincom _b[f] + _b[fed]*edmed + _b[fexp]*expmed + _b[fedsq]*edmed*edmed + _b[fexpsq]*expmed*expmed + _b[fedexp]*edmed*expmed + _b[find7] return list display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Re-save dataset in memory describe, short summarize save, replace describe, short describe summarize log close