10.7 Practice problems
Work each one before opening the solution. The question bank that follows has no answers.
Numerical problems
10.1 A regression of monthly household expenditure (₹) on a dummy for urban residence gives
\[\widehat{\text{expenditure}} = 8{,}400 + 3{,}150\,\text{urban}\]
- What is average expenditure among rural households?
- Among urban households?
- If the dummy had been coded 1 for rural instead, what would the two coefficients be?
(i) ₹8,400. With urban = 0 only the intercept remains.
(ii) \(8{,}400 + 3{,}150 = ₹11{,}550\).
(iii) The intercept becomes the urban mean, ₹11,550, and the coefficient becomes \(8{,}400 - 11{,}550 = -₹3{,}150\). The fitted values, residuals and \(R^2\) are all unchanged — only the reported comparison has reversed.
10.2 A wage regression uses four occupational categories: agriculture, manufacturing, services and government.
- How many dummies should be included alongside an intercept?
- With agriculture as the base group, interpret a coefficient of 0.32 on services in a log-wage regression.
- What happens to that coefficient if government becomes the base group?
(i) Three. Including four alongside an intercept is the dummy variable trap.
(ii) Service workers earn about \(100(e^{0.32}-1) = 37.7\%\) more than agricultural workers. As the coefficient exceeds 0.2, the exact expression is needed.
(iii) It changes, because it now measures services against government rather than against agriculture. The difference between services and agriculture is still recoverable from the new table — it is the difference between their two coefficients.
10.3 From a log-earnings regression with an interaction:
\[\widehat{\ln w} = 9.2 + 0.081\,\text{educ} + 0.74\,\text{urban} - 0.015\,(\text{educ} \times \text{urban})\]
- Write the fitted line for rural workers and for urban workers.
- What is the return to a year of schooling in each group?
- At what level of education do the two groups have equal predicted earnings?
(i) Rural (\(\text{urban}=0\)): \(\widehat{\ln w} = 9.2 + 0.081\,\text{educ}\).
Urban (\(\text{urban}=1\)): \(\widehat{\ln w} = (9.2 + 0.74) + (0.081 - 0.015)\,\text{educ} = 9.94 + 0.066\,\text{educ}\).
(ii) About 8.1% per year in rural areas, 6.6% in urban areas.
(iii) Set the two equal:
\[9.2 + 0.081e = 9.94 + 0.066e \quad\Longrightarrow\quad 0.015e = 0.74 \quad\Longrightarrow\quad e = 49.3\]
At about 49 years of education — far beyond anything observed. Within any real range of schooling the urban line lies above the rural one, and the negative interaction narrows the gap without closing it. This is the same lesson as the turning point in Section 9.6: a crossing point outside the data is an artefact of extrapolation, not a finding.
10.4 A Chow test on rural and urban income–consumption regressions gives \(\text{SSR}_P = 38{,}710.67\), \(\text{SSR}_R = 8{,}661.60\) and \(\text{SSR}_U = 10{,}107.18\), with \(n_R = n_U = 150\).
- Compute the \(F\) statistic.
- State the degrees of freedom and conclude at the 5% level.
(i) \(k = 2\) (intercept and slope).
\[F = \frac{[38{,}710.67 - (8{,}661.60 + 10{,}107.18)]/2} {(8{,}661.60 + 10{,}107.18)/(300 - 4)} = \frac{19{,}941.89/2}{18{,}768.78/296} = \frac{9{,}970.95}{63.41} = 157.3\]
(ii) Degrees of freedom 2 and 296; the 5% critical value is about 3.03. Since \(157.25\) vastly exceeds it, reject: rural and urban households do not share the same income–consumption relationship.
Concept checks
10.5 A student includes dummies for all five states in a sample, plus an
intercept, and reports that R returned NA for the last one. Explain what
happened and give two ways to fix it.
The five dummies sum to 1 for every observation, which is exactly the intercept’s column. One column is an exact linear combination of the others, so CLRM7 fails and there is no unique solution — the situation of Section 8.4.
Two fixes: drop one dummy and treat that state as the base group, or drop the intercept and keep all five, in which case each coefficient is a state mean rather than a difference.
10.6 Explain why entering a five-category variable as the numbers 1 to 5 is usually wrong, and describe the one circumstance in which it might be defensible.
It imposes that the categories are equally spaced and ordered — that moving from 1 to 2 has the same effect as moving from 4 to 5, and that 3 lies between 2 and 4. For unordered categories such as religion or state, none of that is meaningful.
It might be defensible if the categories are genuinely ordered and roughly equally spaced on the scale that matters — for example, five income bands of equal width. Even then, entering dummies and inspecting whether the coefficients rise evenly is the safer choice, because it tests the assumption instead of imposing it.
10.7 In a regression of log wages on experience, a female dummy, and their interaction, the coefficient on experience is 0.043 and the interaction coefficient is \(-0.011\). A colleague reports “the return to experience is 4.3%”. What is wrong, and what are the two correct figures?
0.043 is the return to experience in the base group — men, since the dummy marks women. It is not the return for the sample as a whole.
The two correct figures are about 4.3% per year for men and \(0.043 - 0.011 = 0.032\), about 3.2% per year, for women.
10.8 A Chow test on 40,000 observations rejects at \(p < 0.001\), but the two estimated slopes are 0.0512 and 0.0524. What should be reported?
That the groups are statistically distinguishable and economically indistinguishable.
The slopes differ by roughly one part in forty. With 40,000 observations the test has enough power to detect differences far too small to affect any decision, exactly as Section 4.9 described. Reporting only the \(p\)-value would give a seriously misleading impression; reporting both numbers alongside it does not.
R exercises
10.9 Using wages-india-synthetic.csv, confirm that a regression on a
single dummy reproduces the two-sample \(t\)-test for the male–female earnings
gap. Report the coefficient, the two group means and both \(t\) statistics.
wages <- read.csv("data/wages-india-synthetic.csv")
wages$lw <- log(wages$annual_earnings)
wages$male <- as.integer(wages$sex == "Male")
fit <- lm(lw ~ male, data = wages)
c(coefficient = coef(fit)[2],
female_mean = mean(wages$lw[wages$male == 0]),
male_mean = mean(wages$lw[wages$male == 1]),
reg_t = coef(summary(fit))[2, 3],
ttest_t = abs(t.test(lw ~ sex, data = wages, var.equal = TRUE)$statistic))The intercept is the female mean, the coefficient is the gap, and the two \(t\) statistics agree exactly.
Note what this does not establish. The gap is a difference in average log earnings between two groups; it is not a measure of discrimination, since men and women in these data differ in education, age and residence. Adding those as controls changes the question to a narrower one, and Section 9.10 is the reason even that would need an argument.
10.10 Using student-survey-sleep.csv, test whether the relationship
between social media hours and sleep differs between urban and rural students.
Fit the interacted model, interpret each coefficient, and carry out the Chow
test.
sleep <- read.csv("data/student-survey-sleep.csv")
pooled <- lm(sleep ~ socialmediahours, data = sleep)
interacted <- lm(sleep ~ socialmediahours * residence, data = sleep)
round(coef(summary(interacted)), 4)
anova(pooled, interacted)Nothing is significant. The interaction coefficient is 0.068 with a standard error of 0.237, and the joint \(F\) test does not come close to rejecting.
The honest conclusion is that these 106 students provide no evidence that the relationship differs by residence — not that it is the same. With 32 rural students the test has very little power, so failing to reject was close to guaranteed whatever the truth. This is Section 4.9 in practice, and it is the opposite failure mode from the wage data, where 20,000 observations made a trivial difference significant.
10.11 Show that the base group affects no part of the fit. Regress log earnings on religion using two different base categories and compare the fitted values, \(R^2\) and \(F\) statistic.
wages$rel <- factor(wages$religion)
fit_a <- lm(lw ~ rel, data = wages)
fit_b <- lm(lw ~ relevel(rel, ref = "Hindu"), data = wages)
c(max_fitted_difference = max(abs(fitted(fit_a) - fitted(fit_b))),
r2_a = summary(fit_a)$r.squared, r2_b = summary(fit_b)$r.squared,
f_a = summary(fit_a)$fstatistic[1],
f_b = summary(fit_b)$fstatistic[1])The fitted values agree to machine precision and both summary statistics are identical. Only the coefficient table differs, because only the comparison being reported has changed.
10.12 Fit a model allowing the return to education to differ by sex and by residence simultaneously. Report the four implied slopes and comment on whether the three-way structure is worth the complexity.
m <- lm(lw ~ education * male + education * urban, data = wages)
round(coef(summary(m)), 5)
b <- coef(m)
outer_slopes <- c(
rural_female = b["education"],
rural_male = b["education"] + b["education:male"],
urban_female = b["education"] + b["education:urban"],
urban_male = b["education"] + b["education:male"] + b["education:urban"])
round(outer_slopes, 5)This specification allows each dummy to shift the education slope but assumes those shifts add — the urban adjustment is the same for men and women. A full three-way interaction would relax that too, at the cost of more parameters and a table few readers will follow.
The judgement is the one from Section 9.7: every additional interaction consumes variation and widens standard errors. Interactions should be included because a question requires them, not because they are available.