log using 452note05_exercises_f13.log, replace version set more off * * To execute (run) this Stata do file, enter on the command line the following * command: * * do 452note05_exercises_f13.txt * * Do file: 452note05_exercises_f13.txt * Log file: 452note05_exercises_f13.log * * Input dataset: wage1_econ452_note05.dta * Output dataset: wage1_econ452_note05_stata13.dta (re-saved) * use wage1_econ452_note05, clear describe, short describe summarize * 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 * Verify adding-up property for 7 industry dummy variables generate sumind = ind1 + ind2 + ind3 + ind4 + ind5 + ind6 + ind7 summarize sumind drop sumind * 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 * Generate the natural log of the average hourly earnings variable 'wage' = lnw generate lnw = ln(wage) summarize wage lnw * Generate Female Interactions with All Other Regressors 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 * Verify gender indicators f & m * describe f m summarize f m tab1 f m, missing tab2 f m, missing summarize wage lnw ed exp if f == 1 summarize wage lnw ed exp if m == 0 summarize wage lnw ed exp if f == 0 summarize wage lnw ed exp if m == 1 * * Note 5 -- Model 1: No Dummy Variable Regressors * regress lnw ed exp edsq expsq edexp ereturn list * * Note 5 -- Model 2: One Additive Two-Category Dummy Variable Regressor * Gender represented by female indicator 'f' * regress lnw ed exp edsq expsq edexp f ereturn list lincom _b[_cons] + _b[f] * * Note 5 -- Model 3: Gender base group = males * regress lnw ed exp edsq expsq edexp f fed fexp fedsq fexpsq fedexp ereturn list * Note 5 -- Model 3: 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] * Note 5 -- Model 3: Display the male coefficient estimates lincom _b[_cons] lincom _b[ed] lincom _b[exp] lincom _b[edsq] lincom _b[expsq] lincom _b[edexp] * Note 5 -- Model 3: Display the female-male coefficient differences lincom _b[f] lincom _b[fed] lincom _b[fexp] lincom _b[fedsq] lincom _b[fexpsq] lincom _b[fedexp] * * Note 5 -- Model 3: Tests for Female-Male Coefficient Differences * * Test 1 - Model 3: Females & Males have identical mean lnw values test f fed fexp fedsq fexpsq fedexp return list * Test 2 - Model 3: Female-Male difference in mean lnw is a constant test fed fexp fedsq fexpsq fedexp return list * Test 3 - Model 3: Female-Male difference in mean lnw unrelated to ed * Marginal effect of ed equal for females & males test fed fedsq fedexp return list * Test 4 - Model 3: Female-Male difference in mean lnw unrelated to exp * Marginal effect of exp equal for females & males test fexp fexpsq fedexp return list * Test 5 - Model 3: Female-Male difference in mean lnw is linear in ed & exp * Marginal effects of ed & exp are constant test fedsq fexpsq fedexp return list * * Note 5 -- Model 3: Tests on marginal effect of ed for Males * * Test 1m - Model 3: Marginal effect of ed for Males is zero test ed edsq edexp return list * Test 2m - Model 3: Marginal effect of ed for Males is a constant test edsq edexp return list * Test 3m: Marginal effect 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))) * Test 4m: Marginal effect 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))) * * Note 5 -- Model 3: Tests on marginal effect of ed for Females * * Test 1f - Model 3: Marginal effect of ed for Females is zero test ed + fed = 0, notest test edsq + fedsq = 0, notest accumulate test edexp + fedexp = 0, accumulate return list * Test 2f - Model 3: Marginal effect of ed for Females is a constant test edsq + fedsq = 0, notest test edexp + fedexp = 0, accumulate return list * Test 3f - Model 3: Marginal effect of ed for Females unrelated to exp test edexp + fedexp = 0 return list lincom _b[edexp] + _b[fedexp] display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * Test 4f - Model 3: Marginal effect of ed for Females unrelated to ed test edsq + fedsq = 0 return list lincom _b[edsq] + _b[fedsq] display r(estimate)/r(se) display 2*ttail(r(df), abs(r(estimate)/r(se))) * * Note 5 -- Model 3*: Alternative Formulation Using Male Dummy Variable 'm' * * * Generate Male Interactions with All Other Regressors generate med = m*ed generate mexp = m*exp generate medsq = m*edsq generate mexpsq = m*expsq generate medexp = m*edexp summarize m med mexp medsq mexpsq medexp * OLS estimation of Model 3* regress lnw ed exp edsq expsq edexp m med mexp medsq mexpsq medexp ereturn list * Note 5 -- Model 3*: Compute the male coefficient estimates lincom _b[_cons] + _b[m] lincom _b[ed] + _b[med] lincom _b[exp] + _b[mexp] lincom _b[edsq] + _b[medsq] lincom _b[expsq] + _b[mexpsq] lincom _b[edexp] + _b[medexp] * Note 5 -- Model 3*: Display the female coefficient estimates lincom _b[_cons] lincom _b[ed] lincom _b[exp] lincom _b[edsq] lincom _b[expsq] lincom _b[edexp] * Note 5 -- Model 3*: Display the male-female coefficient differences lincom _b[m] lincom _b[med] lincom _b[mexp] lincom _b[medsq] lincom _b[mexpsq] lincom _b[medexp] * Note 5 -- Model 3*: Repeat some hypothesis tests previously performed on Model 3 * * Test 1 - Model 3*: Females & Males have identical mean lnw values test m med mexp medsq mexpsq medexp return list * Test 2 - Model 3*: Female-Male difference in mean lnw is a constant test med mexp medsq mexpsq medexp return list * Test 3 - Model 3*: Female-Male difference in mean lnw unrelated to ed * Marginal effect of ed equal for females & males test med medsq medexp return list * Test 4 - Model 3*: Female-Male difference in mean lnw unrelated to exp * Marginal effect of ed equal for females & males test mexp mexpsq medexp return list * Test 5 - Model 3*: Female-Male difference in mean lnw is linear in ed & exp * Marginal effects of ed & exp are constant test medsq mexpsq medexp return list * * Save dataset in memory as Stata 13 format dataset 'wage1_econ452_note05_stata13' * save wage1_econ452_note05_stata13, replace describe, short describe summarize log close clear