الاقتصاد · الكتاب 4 · السنة الجامعية 2

University Economics — Year 2

هذا الكتاب غير متوفر بعد باللغة العربية. النسخ المتوفرة: English.

University Economics — Year 2 · السنة الجامعية 2

30Multiple Regression

A regression with one regressor compares people who differ in that regressor and, usually, in much else. Adding regressors compares people who differ in the first and are alike in the others. This chapter writes the model in matrix form, derives the least-squares estimator, shows what “holding the others constant” means exactly, and measures what leaving a variable out does to a coefficient. The chart shows the question on real data: the estimated return to a year of schooling as the comparison is made more like for like.

Estimated effect of a year of schooling on log earnings in 1978, per cent, as controls are added one at a time, with 95 per cent confidence intervals; American men with positive earnings in 1975 and 1978 (13,055 men).
Estimated effect of a year of schooling on log earnings in 1978, per cent, as controls are added one at a time, with 95 per cent confidence intervals; American men with positive earnings in 1975 and 1978 (13,055 men). Source: CPS comparison sample of LaLonde (1986), as distributed by Dehejia and Wahba; our computation

With no control, a year of schooling goes with log earnings 4.10 per cent higher. Adding age raises the estimate to 5.22; adding age squared brings it to 3.99; race and marriage move it little; adding 1975 earnings halves it, to 2.04. Each number is a correct answer to a different question. Which question is the right one is not a matter of statistics, and the last step is a warning taken up in Chapter 32.

You already know

From the Year 1 volume: the ordinary least squares estimator with one regressor, fitted values and residuals, the error term, the zero conditional mean assumption, R2R^2, the omitted variable, estimators, standard errors and confidence intervals. From mathematics: matrices, the transpose, the inverse, the rank, and orthogonal projection.

30.1 The model in matrix form

Definition 30.1 (Multiple regression model)

The multiple regression model writes an outcome as a linear function of several regressors plus an error: yi=β0+β1xi1+⋯+βk−1xi,k−1+uiy_i = \beta_0 + \beta_1x_{i1} + \dots + \beta_{k-1}x_{i,k-1} + u_i, i=1,…,ni = 1, \dots, n.

Definition 30.2 (Regressor matrix)

The regressor matrix XX is the n×kn \times k matrix whose row ii is (1,xi1,…,xi,k−1)(1, x_{i1}, \dots, x_{i,k-1}): one row per observation, one column per regressor, the first column a column of ones.

With yy and uu the nn-vectors of outcomes and errors and β\beta the kk-vector of coefficients, the model is y=Xβ+uy = X\beta + u. Three assumptions make β\beta the object least squares estimates: the model is linear in β\beta; XX has full column rank kk, so that no column is a linear combination of the others; and E[u∣X]=0E[u \mid X] = 0, so that the errors have mean zero whatever the regressors. The coefficient βj\beta_j is then the change in the conditional mean of yy when xjx_j rises by one and the other regressors are held fixed.

30.2 The least-squares estimator

Least squares chooses bb to minimise the sum of squared residuals (y−Xb)′(y−Xb)=y′y−2b′X′y+b′X′Xb(y - Xb)'(y - Xb) = y'y - 2b'X'y + b'X'Xb. Setting the gradient −2X′y+2X′Xb-2X'y + 2X'Xb to zero gives the following equations.

Definition 30.3 (Normal equations)

The normal equations of least squares are X′Xb=X′yX'Xb = X'y; when XX has full column rank, X′XX'X is invertible and they have the single solution β^=(X′X)−1X′y\hat\beta = (X'X)^{-1}X'y.

The normal equations say X′(y−Xβ^)=X′e=0X'(y - X\hat\beta) = X'e = 0: the residual vector ee is orthogonal to every column of XX. So the fitted vector y^=Xβ^\hat y = X\hat\beta is the orthogonal projection of yy on the space spanned by the columns of XX, and ee is what is left, at right angles to that space. With a column of ones in XX, the residuals sum to zero.

Least squares as projection. The fitted vector is the point of the column space closest to y; the residual is orthogonal to the column space, which is what the normal equations say.
Least squares as projection. The fitted vector is the point of the column space closest to yy; the residual is orthogonal to the column space, which is what the normal equations say.

The listings use the CPS comparison sample described in the box. The first loads it; the second solves the normal equations with numpy and compares the result with statsmodels.

How it is measured — The comparison sample

LaLonde (1986) asked whether econometric methods applied to survey data could reproduce what a field experiment had found about a training programme. To do so he built comparison samples of men from two American surveys, the Current Population Survey and the Panel Study of Income Dynamics. Dehejia and Wahba (1999) re-examined the same samples and distribute them; the CPS one has 15,992 men, with their age, schooling, race, marital status, whether they have a high-school diploma, and their earnings in 1974, 1975 and 1978. In the file, 25.9 per cent of the men have 1978 earnings equal to the largest value, 25,564.7: earnings above some level were recorded at that level, so the top of the distribution is cut off. This chapter uses the 13,055 men with positive earnings in both 1975 and 1978. Dropping the men with no earnings in 1978 selects on the outcome itself, so the coefficients describe men in work, not all men; the experiment itself returns in Chapter 33.

"""The CPS comparison sample: men with positive earnings in 1975 and 1978."""

import numpy as np
from econdata import nsw

d = nsw("cps_controls")
cap = d.re78.max()
print(f"men in the file: {len(d)}")
print(f"share at the 1978 maximum of {cap:,.1f}: {(d.re78 == cap).mean():.1%}")

d = d[(d.re78 > 0) & (d.re75 > 0)].copy()
d["lre78"] = np.log(d.re78)
d["lre75"] = np.log(d.re75)
print(f"men with positive earnings in 1975 and 1978: {len(d)}")

cols = ["lre78", "education", "age", "black", "hispanic", "married", "lre75"]
table = d[cols].describe().loc[["mean", "std", "min", "max"]].T
print(table.round(2).to_string())
Listing 30.1. Loading the comparison sample and the regression sample. code/bachelor-2/30-multiple-regression/listings/load_cps.py
$ python load_cps.py
men in the file: 15992
share at the 1978 maximum of 25,564.7: 25.9%
men with positive earnings in 1975 and 1978: 13055
            mean    std    min    max
lre78       9.55   0.90   1.08  10.15
education  12.03   2.85   0.00  18.00
age        33.24  10.81  16.00  55.00
black       0.07   0.25   0.00   1.00
hispanic    0.07   0.26   0.00   1.00
married     0.73   0.44   0.00   1.00
lre75       9.36   1.03   2.37  10.14
Output 30.1. A quarter of the men are at the earnings cap; the regression sample keeps 13,055 men.
"""Least squares by the normal equations, against statsmodels."""

import numpy as np
import statsmodels.api as sm
from econdata import nsw

d = nsw("cps_controls")
d = d[(d.re78 > 0) & (d.re75 > 0)]
y = np.log(d.re78).to_numpy()
names = ["const", "education", "age", "age2", "black", "hispanic", "married"]
cols = [np.ones(len(d)), d.education, d.age, d.age**2, d.black, d.hispanic, d.married]
X = np.column_stack(cols)
n, k = X.shape

beta = np.linalg.solve(X.T @ X, X.T @ y)  # the normal equations X'X b = X'y
fit = sm.OLS(y, X).fit()
for name, b, b_sm in zip(names, beta, fit.params):
    print(f"{name:10s} {b:12.6f} {b_sm:12.6f}")
print("same coefficients to 1e-8:", np.allclose(beta, fit.params, rtol=0, atol=1e-8))

e = y - X @ beta
print("residuals orthogonal to every column:", np.allclose(X.T @ e, 0, atol=1e-5))
r2 = 1 - (e @ e) / ((y - y.mean()) @ (y - y.mean()))
adj = 1 - (1 - r2) * (n - 1) / (n - k)
print(f"R2 {r2:.4f} ({fit.rsquared:.4f}), adjusted {adj:.4f} ({fit.rsquared_adj:.4f})")
Listing 30.2. The normal equations solved with numpy, against statsmodels. code/bachelor-2/30-multiple-regression/listings/ols_by_hand.py
$ python ols_by_hand.py
const          7.100734     7.100734
education      0.038343     0.038343
age            0.098755     0.098755
age2          -0.001202    -0.001202
black         -0.170828    -0.170828
hispanic      -0.052405    -0.052405
married        0.262576     0.262576
same coefficients to 1e-8: True
residuals orthogonal to every column: True
R2 0.1181 (0.1181), adjusted 0.1177 (0.1177)
Output 30.2. The same coefficients either way; the residuals are orthogonal to every column.

Holding age, race and marriage fixed, a year of schooling goes with earnings 3.83 per cent higher; married men earn 26.3 log points more than unmarried men of the same age, schooling and race. Age enters with a positive coefficient and a negative one on its square: earnings rise with age at a falling rate.

30.3 Partialling out

What does “holding the others fixed” do to the data? Split the regressors into xx, the one of interest, and WW, the others (with the column of ones), so that y=xβ1+Wγ+uy = x\beta_1 + W\gamma + u.

Definition 30.4 (Frisch–Waugh–Lovell theorem)

The Frisch–Waugh–Lovell theorem states that the least-squares coefficient on xx in the regression of yy on xx and WW equals the coefficient in the regression of y~\tilde y on x~\tilde x, where y~\tilde y and x~\tilde x are the residuals from regressing yy and xx on WW.

Proposition 30.5 (Frisch–Waugh–Lovell)

Let M=I−W(W′W)−1W′M = I - W(W'W)^{-1}W', x~=Mx\tilde x = Mx and y~=My\tilde y = My. Then the coefficient on xx in the regression of yy on (x,W)(x, W) is β^1=x~′y~/x~′x~=x~′y/x~′x~\hat\beta_1 = \tilde x'\tilde y/\tilde x'\tilde x = \tilde x'y/\tilde x'\tilde x.

Proof. MM is symmetric, MM=MMM = M, and MW=0MW = 0. Write y=xβ^1+Wγ^+ey = x\hat\beta_1 + W\hat\gamma + e, with ee orthogonal to xx and to every column of WW. Then Me=eMe = e, since ee is already orthogonal to WW. Multiply by MM: My=Mxβ^1+eMy = Mx\hat\beta_1 + e. Multiply by x′x': x′My=x′Mx β^1+x′e=x′Mx β^1x'My = x'Mx\,\hat\beta_1 + x'e = x'Mx\,\hat\beta_1. Since x′My=(Mx)′(My)=x~′y~x'My = (Mx)'(My) = \tilde x'\tilde y and x′Mx=x~′x~x'Mx = \tilde x'\tilde x, β^1=x~′y~/x~′x~\hat\beta_1 = \tilde x'\tilde y/\tilde x'\tilde x; and x~′y~=x~′My=(Mx~)′y=x~′y\tilde x'\tilde y = \tilde x'My = (M\tilde x)'y = \tilde x'y. ∎

The coefficient on schooling uses only the variation in schooling that age, race and marriage do not predict. The rest of the variation is discarded.

"""Frisch-Waugh-Lovell: the education coefficient by partialling out the controls."""

import numpy as np
from econdata import nsw

d = nsw("cps_controls")
d = d[(d.re78 > 0) & (d.re75 > 0)]
y = np.log(d.re78).to_numpy()
x = d.education.to_numpy(dtype=float)
W = np.column_stack([np.ones(len(d)), d.age, d.age**2, d.black, d.hispanic, d.married])


def resid(v, M):
    """Residual of v after least squares on the columns of M."""
    return v - M @ np.linalg.lstsq(M, v, rcond=None)[0]


b_long = np.linalg.lstsq(np.column_stack([x, W]), y, rcond=None)[0][0]
rx = resid(x, W)
ry = resid(y, W)
b_fwl = (rx @ ry) / (rx @ rx)
b_half = (rx @ y) / (rx @ rx)
b_short = np.linalg.lstsq(np.column_stack([np.ones(len(d)), x]), y, rcond=None)[0][1]

print(f"long regression:               {b_long:.6f}")
print(f"residual on residual:          {b_fwl:.6f}")
print(f"y on residualised x:           {b_half:.6f}")
print(f"education alone (no controls): {b_short:.6f}")
print(f"variance of x {x.var():.3f}; of its residual {rx.var():.3f}")
Listing 30.3. Partialling out the controls gives the same coefficient as the long regression. code/bachelor-2/30-multiple-regression/listings/fwl.py
$ python fwl.py
long regression:               0.038343
residual on residual:          0.038343
y on residualised x:           0.038343
education alone (no controls): 0.040973
variance of x 8.101; of its residual 7.117
Output 30.3. Three routes, one coefficient; the controls remove an eighth of the variance of schooling.

30.4 The omitted-variable bias formula

Definition 30.6 (Omitted-variable bias)

Omitted-variable bias is the difference between the coefficient on a regressor in a regression that leaves out a variable and the coefficient in the regression that includes it.

Let the long regression be y=xβ^1+Wβ^W+zγ^+ey = x\hat\beta_1 + W\hat\beta_W + z\hat\gamma + e and the short one leave zz out. Let δ^\hat\delta be the coefficient on xx when zz itself is regressed on xx and WW. Then, exactly in any sample,

β^1short=β^1long+γ^ δ^.(30.1)\hat\beta_1^{\text{short}} = \hat\beta_1^{\text{long}} + \hat\gamma\,\hat\delta.\tag{30.1}

Proof: regress both sides of y=xβ^1+Wβ^W+zγ^+ey = x\hat\beta_1 + W\hat\beta_W + z\hat\gamma + e on xx and WW. Least squares is linear in the outcome, the regression of xx and of WW on themselves gives coefficient one on themselves, ee is orthogonal to xx and WW so its coefficients are zero, and zz gives δ^\hat\delta on xx (Exercise 11).

The formula needs only two signs: the effect of the omitted variable on the outcome and its association with the regressor.

zz and xx positively associated (δ>0\delta > 0)negatively associated (δ<0\delta < 0)
zz raises yy (γ>0\gamma > 0)short coefficient too highshort coefficient too low
zz lowers yy (γ<0\gamma < 0)short coefficient too lowshort coefficient too high
The sign of the omitted-variable bias γδ\gamma\delta. Adding age in the opening chart raised the estimate: earnings rise with age, and older men in the sample have less schooling.
"""The omitted-variable bias formula, short = long + gamma delta."""

import numpy as np
from econdata import nsw

d = nsw("cps_controls")
d = d[(d.re78 > 0) & (d.re75 > 0)]
y = np.log(d.re78).to_numpy()
z = np.log(d.re75).to_numpy()  # the variable left out of the short regression
W = np.column_stack([np.ones(len(d)), d.education, d.age, d.age**2, d.black,
                     d.hispanic, d.married])  # fmt: skip


def ols(target, M):
    return np.linalg.lstsq(M, target, rcond=None)[0]


short = ols(y, W)[1]
full = ols(y, np.column_stack([W, z]))
long, gamma = full[1], full[-1]
delta = ols(z, W)[1]

print(f"short regression (no 1975 earnings): {short:.6f}")
print(f"long regression:                     {long:.6f}")
print(f"gamma, effect of log 1975 earnings:  {gamma:.6f}")
print(f"delta, 1975 earnings on education:   {delta:.6f}")
print(f"long + gamma * delta:                {long + gamma * delta:.6f}")
print("equal to 1e-12:", abs(short - long - gamma * delta) < 1e-12)
Listing 30.4. The omitted-variable bias formula checked on the sample. code/bachelor-2/30-multiple-regression/listings/ovb.py
$ python ovb.py
short regression (no 1975 earnings): 0.038343
long regression:                     0.020429
gamma, effect of log 1975 earnings:  0.399801
delta, 1975 earnings on education:   0.044806
long + gamma * delta:                0.038343
equal to 1e-12: True
Output 30.4. Adding 1975 earnings: 0.020429+0.399801×0.044806=0.0383430.020429 + 0.399801 \times 0.044806 = 0.038343.

A man with 1 per cent higher earnings in 1975, at the same schooling, age, race and marriage, earns 0.40 per cent more in 1978; and a year of schooling goes with 4.5 per cent higher 1975 earnings. The product, 1.8 points, is the part of the schooling coefficient that 1975 earnings take over. Whether it should be taken over is another matter: 1975 earnings are themselves partly a result of schooling, so controlling for them removes part of the effect being measured.

30.5 Near-collinear regressors

Definition 30.7 (Perfect collinearity)

Regressors are perfectly collinear when one column of XX is an exact linear combination of the others; XX then has rank below kk, X′XX'X is singular, and the coefficients are not identified.

A common case is a full set of indicator variables with a constant: an indicator for married men, one for unmarried men, and the column of ones, which is their sum. Near-collinearity is not a failure of the assumptions, but it costs precision. Under the assumptions of Chapter 31, with Rj2R_j^2 the R2R^2 of the regression of xjx_j on the other regressors and sj2s_j^2 the sample variance of xjx_j,

Var⁡(β^j∣X)=σ2nsj2(1−Rj2).(30.2)\operatorname{Var}(\hat\beta_j \mid X) = \frac{\sigma^2}{ns_j^2(1 - R_j^2)}.\tag{30.2}

The formula follows from the Frisch–Waugh–Lovell theorem: β^j\hat\beta_j is a regression on x~j\tilde x_j, whose sum of squares is nsj2(1−Rj2)ns_j^2(1 - R_j^2) (Exercise 12).

Definition 30.8 (Variance inflation factor)

The variance inflation factor of regressor jj is 1/(1−Rj2)1/(1 - R_j^2): the factor by which the variance of β^j\hat\beta_j exceeds what it would be if xjx_j were uncorrelated with the other regressors.

"""Near-collinear regressors: the standard error of b1 as the correlation rises."""

import numpy as np
import statsmodels.api as sm

rng = np.random.default_rng(30)
n = 500
print("  rho   corr in sample   b1     se(b1)    VIF")
for rho in (0.0, 0.5, 0.9, 0.99):
    x1 = rng.standard_normal(n)
    x2 = rho * x1 + np.sqrt(1 - rho**2) * rng.standard_normal(n)
    y = 1 + x1 + x2 + rng.standard_normal(n)
    fit = sm.OLS(y, sm.add_constant(np.column_stack([x1, x2]))).fit()
    r = np.corrcoef(x1, x2)[0, 1]
    vif = 1 / (1 - r**2)
    print(f"{rho:5.2f}  {r:14.3f}  {fit.params[1]:6.3f}  {fit.bse[1]:7.3f}  {vif:6.1f}")

x1 = rng.standard_normal(n)
X = np.column_stack([np.ones(n), x1, 2 * x1])
print(f"rank of X with x2 = 2 x1: {np.linalg.matrix_rank(X)} of {X.shape[1]} columns")
Listing 30.5. Simulated regressors with rising correlation, and an exactly collinear design. code/bachelor-2/30-multiple-regression/listings/collinearity.py
$ python collinearity.py
  rho   corr in sample   b1     se(b1)    VIF
 0.00          -0.028   1.002    0.045     1.0
 0.50           0.538   0.934    0.057     1.4
 0.90           0.906   1.019    0.103     5.6
 0.99           0.990   1.123    0.311    48.5
rank of X with x2 = 2 x1: 2 of 3 columns
Output 30.5. The standard error grows with the correlation roughly as the square root of the VIF; with an exact multiple the matrix loses a rank.

At a correlation of 0.99 the variance inflation factor is 48.5 and the standard error of β^1\hat\beta_1 is 0.311, about seven times the 0.045 of uncorrelated regressors; the estimate itself is still unbiased. Near-collinearity is a shortage of information about the separate effects, not an error to be corrected; the remedies are more data or a question that does not need the separate effects.

30.6 Fit

The R2R^2 of a multiple regression is 1−e′e/∑i(yi−yˉ)21 - e'e/\sum_i(y_i - \bar y)^2, as with one regressor. Adding a regressor never lowers it, since least squares could always set the new coefficient to zero.

Definition 30.9 (Adjusted R-squared)

The adjusted R2R^2 is Rˉ2=1−e′e/(n−k)∑i(yi−yˉ)2/(n−1)=1−(1−R2)n−1n−k\bar R^2 = 1 - \frac{e'e/(n - k)}{\sum_i(y_i - \bar y)^2/(n - 1)} = 1 - (1 - R^2)\frac{n - 1}{n - k}; it can fall when a regressor is added.

In the listing R2R^2 is 0.1181 and Rˉ2\bar R^2 0.1177: with 13,055 observations and seven coefficients the correction is tiny. Neither number says whether the coefficient on schooling is the effect of schooling. Adding 1975 earnings raises R2R^2 from 0.118 to 0.254 and moves the schooling coefficient from 3.83 to 2.04; a better fit is not a better answer to a causal question.

Model — The linear regression model

Assumes. The conditional mean of the outcome is linear in the regressors; the regressor matrix has full column rank; the error has mean zero given the regressors.

Predicts. Least squares estimates each coefficient without bias: the change in the mean outcome when one regressor rises by one and the others are held fixed.

Tested. Linearity can be checked against more flexible forms (Chapter 32); the zero conditional mean assumption cannot be tested from the residuals, which are orthogonal to the regressors by construction, but can be tested against an experiment, as LaLonde did (Chapter 33).

Breaks. When a variable that affects the outcome and is correlated with a regressor is left out, the coefficient absorbs its effect, by the amount γδ\gamma\delta; and when a control is itself an outcome of the regressor, holding it fixed removes part of the effect.

30.7 Exercises

Exercise 30.1 ★

Read the opening chart. Give the estimate with no control, after adding age, and with every control. Which single step moves the estimate most?

Solution

Solution of Exercise 30.1.

4.10 per cent with no control, 5.22 after adding age, 2.04 with every control. The largest single move is the last, adding log 1975 earnings: from 3.83 to 2.04, 1.79 points; adding age squared moves it 1.23 points, adding age 1.12.

Exercise 30.2 ★

A quarter of the men have 1978 earnings at the cap. What does the cap do to the measured differences in log earnings between men with much schooling and men with little?

Solution

Solution of Exercise 30.2.

Men above the cap are recorded at the cap, so high earners appear to earn less than they do. Men with much schooling are more often above the cap, so the cap compresses the gap between them and men with little schooling: the measured return to schooling is likely too small.

Exercise 30.3 ★

Compute Rˉ2\bar R^2 from R2=0.1181R^2 = 0.1181, n=13,055n = 13{,}055 and k=7k = 7.

Solution

Solution of Exercise 30.3.

1−(1−0.1181)×13,054/13,048=1−0.8819×1.00046=0.11771 - (1 - 0.1181) \times 13{,}054/13{,}048 = 1 - 0.8819 \times 1.00046 = 0.1177.

Exercise 30.4 ★

1975 earnings are measured after most of the men had finished school. Why might controlling for them be a mistake? What would show that a control is a bad one?

Solution

Solution of Exercise 30.4.

Schooling raises 1975 earnings, and 1975 earnings predict 1978 earnings. Holding 1975 earnings fixed compares men with different schooling but the same 1975 earnings, which removes the part of the effect of schooling that works through earlier earnings. A control is bad if it is itself affected by the regressor: evidence would be that the regressor predicts the control (here a year of schooling goes with 4.5 per cent higher 1975 earnings), or, better, that the control was measured after the regressor was set.

Exercise 30.5 ★★

By hand: with five observations, x=(1,2,3,4,5)x = (1, 2, 3, 4, 5), d=(0,0,1,1,1)d = (0, 0, 1, 1, 1) and y=(4,4,9,13,14)y = (4, 4, 9, 13, 14), regress yy on a constant, xx and dd. Write X′XX'X and X′yX'y, solve the normal equations, and compute R2R^2 and Rˉ2\bar R^2.

Solution

Solution of Exercise 30.5.

X′X=(51531555123123)X'X = \begin{pmatrix}5 & 15 & 3\\ 15 & 55 & 12\\ 3 & 12 & 3\end{pmatrix}, X′y=(44,161,36)′X'y = (44, 161, 36)'. The solution is b=(1,2,3)′b = (1, 2, 3)': check 5+30+9=445 + 30 + 9 = 44, 15+110+36=16115 + 110 + 36 = 161, 3+24+9=363 + 24 + 9 = 36. Fitted values 3,5,10,12,143, 5, 10, 12, 14; residuals 1,−1,−1,1,01, -1, -1, 1, 0, so e′e=4e'e = 4. With yˉ=8.8\bar y = 8.8, ∑(yi−yˉ)2=90.8\sum(y_i - \bar y)^2 = 90.8, so R2=1−4/90.8=0.956R^2 = 1 - 4/90.8 = 0.956 and Rˉ2=1−(4/2)/(90.8/4)=0.912\bar R^2 = 1 - (4/2)/(90.8/4) = 0.912.

Exercise 30.6 ★★

Predict, then compute: adding age raises the schooling coefficient from 4.10 to 5.22. The correlation between age and schooling in the sample is −0.15-0.15; age has a coefficient of 0.0192 in the long regression, and the regression of age on schooling has slope −0.585-0.585. Check the omitted-variable bias formula.

Solution

Solution of Exercise 30.6.

Earnings rise with age (γ>0\gamma > 0) and older men have less schooling (δ<0\delta < 0), so leaving age out biases the schooling coefficient down. The formula: 0.0522+0.0192×(−0.585)=0.0522−0.0112=0.04100.0522 + 0.0192 \times (-0.585) = 0.0522 - 0.0112 = 0.0410, the short coefficient.

Exercise 30.7 ★★

(D) (a) With the Brenland household survey, regress the log gross income of heads with positive income on years of schooling, then add age and age squared. (b) With the CPS sample, add nodegree to the regression of the listing ols_by_hand.py. What happens to the schooling coefficient, its standard error, and its variance inflation factor?

Solution

Solution of Exercise 30.7.

(a) 5.80 per cent per year of schooling with no control, R2=0.108R^2 = 0.108; 5.84 per cent with age and age squared, R2=0.309R^2 = 0.309. (b) With nodegree the schooling coefficient falls from 3.83 to 2.16 per cent; men without a diploma earn 14.8 log points less at the same years of schooling. The standard error rises from 0.0028 to 0.0039, and the VIF of schooling from 1.14 to 2.24: years of schooling and having a diploma are strongly related.

Exercise 30.8 ★★

Change nn to 2000 in the collinearity listing. By what factor should the standard errors fall? Compare with the output.

Solution

Solution of Exercise 30.8.

By (30.2) the standard error falls as 1/n1/\sqrt n: by a factor of 2. The output gives 0.022, 0.025, 0.052 and 0.160 against 0.045, 0.057, 0.103 and 0.311. The ratios are close to 2, though not exactly, because new draws give new sample correlations.

Exercise 30.9 ★★

A regression includes a constant, an indicator for married men and an indicator for unmarried men. Show that XX does not have full column rank. Give two ways to fix it, and say what the coefficients then mean.

Solution

Solution of Exercise 30.9.

The column of ones equals the sum of the two indicators, so the three columns are linearly dependent and the rank is 2. Either drop one indicator: the constant is then the mean for the omitted group (other regressors fixed) and the remaining coefficient the difference between the groups. Or drop the constant: each indicator’s coefficient is its group’s mean.

Exercise 30.10 ★★★

Show that M=I−W(W′W)−1W′M = I - W(W'W)^{-1}W' is symmetric and idempotent, that MW=0MW = 0, and that MyMy is the residual vector of the regression of yy on WW.

Solution

Solution of Exercise 30.10.

Let P=W(W′W)−1W′P = W(W'W)^{-1}W'. Then P′=W((W′W)−1)′W′=PP' = W((W'W)^{-1})'W' = P, since W′WW'W is symmetric, and

PP=W(W′W)−1W′W(W′W)−1W′=P.PP = W(W'W)^{-1}W'W(W'W)^{-1}W' = P.

So M=I−PM = I - P is symmetric and MM=I−2P+P=MMM = I - 2P + P = M. MW=W−W(W′W)−1W′W=0MW = W - W(W'W)^{-1}W'W = 0. The regression of yy on WW has coefficients (W′W)−1W′y(W'W)^{-1}W'y and fitted values PyPy, so its residual is y−Py=Myy - Py = My.

Exercise 30.11 ★★★

Prove (30.1) in full.

Solution

Solution of Exercise 30.11.

Let Z=(x,W)Z = (x, W) and A=(Z′Z)−1Z′A = (Z'Z)^{-1}Z', so that the short regression’s coefficients are AyAy. From the long regression, y=Zb^+zγ^+ey = Z\hat b + z\hat\gamma + e, where b^\hat b collects β^1\hat\beta_1 and β^W\hat\beta_W. Then Ay=AZb^+Az γ^+Ae=b^+γ^AzAy = AZ\hat b + Az\,\hat\gamma + Ae = \hat b + \hat\gamma Az, since AZ=IAZ = I and Z′e=0Z'e = 0. The first element of AzAz is δ^\hat\delta, so β^1short=β^1long+γ^δ^\hat\beta_1^{\text{short}} = \hat\beta_1^{\text{long}} + \hat\gamma\hat\delta.

Exercise 30.12 ★★★

Using the Frisch–Waugh–Lovell theorem and Var⁡(u∣X)=σ2I\operatorname{Var}(u \mid X) = \sigma^2I, derive (30.2).

Solution

Solution of Exercise 30.12.

By the theorem β^j=x~j′y/x~j′x~j\hat\beta_j = \tilde x_j'y/\tilde x_j'\tilde x_j with x~j=Mxj\tilde x_j = Mx_j, a function of XX only. With y=Xβ+uy = X\beta + u, x~j′y=x~j′xjβj+x~j′u\tilde x_j'y = \tilde x_j'x_j\beta_j + \tilde x_j'u (since x~j\tilde x_j is orthogonal to the other columns), and x~j′xj=x~j′x~j\tilde x_j'x_j = \tilde x_j'\tilde x_j. So β^j−βj=x~j′u/x~j′x~j\hat\beta_j - \beta_j = \tilde x_j'u/\tilde x_j'\tilde x_j and Var⁡(β^j∣X)=σ2x~j′x~j/(x~j′x~j)2=σ2/x~j′x~j\operatorname{Var}(\hat\beta_j \mid X) = \sigma^2\tilde x_j'\tilde x_j/(\tilde x_j'\tilde x_j)^2 = \sigma^2/\tilde x_j'\tilde x_j. The sum of squared residuals of xjx_j on the others is (1−Rj2)∑i(xij−xˉj)2=(1−Rj2)nsj2(1 - R_j^2)\sum_i(x_{ij} - \bar x_j)^2 = (1 - R_j^2)ns_j^2.

30.8 Problem: Brenland’s household survey

Problem 30.1

Weekend problem — Brenland’s household survey: matrices, the return to schooling with controls, partialling out and omitted-variable bias, and the collinearity of age and experience

Brenland’s household survey of 2025 has 2,000 households; 1,922 heads have positive gross income. Let yiy_i be the log gross income of head ii, sis_i his years of schooling and aia_i his age.

Part I — Matrices.

  1. Write the regressor matrix of the regression of yy on a constant, ss, aa and a2a^2: its size and a typical row.
  2. What is the size of X′XX'X? Of X′yX'y?
  3. What does the first element of X′XX'X count? The first element of X′yX'y?
  4. Why must X′XX'X be invertible for the estimator to exist?
  5. What does the first normal equation say about the residuals?

Part II — Returns to schooling with controls.

  1. Regress yy on a constant and ss. Give the coefficient on ss and R2R^2.
  2. Add aa and a2a^2. Give the coefficient on ss, its 95 per cent confidence interval, R2R^2 and Rˉ2\bar R^2.
  3. Interpret the coefficient on ss in the long regression.
  4. At what age is predicted income highest, holding schooling fixed?
  5. Why does the coefficient on ss barely move?

Part III — Partialling out and omitted-variable bias.

  1. Regress ss on a constant, aa and a2a^2, and keep the residual s~\tilde s. Compare the variances of ss and s~\tilde s.
  2. Regress yy on s~\tilde s. What coefficient do you get?
  3. Give δa\delta_a and δa2\delta_{a^2}, the coefficients on ss when aa and a2a^2 are regressed on a constant and ss.
  4. Write the short coefficient as the long one plus the bias, with two omitted variables.
  5. Compute the bias and check the identity.
  6. Why are δa\delta_a and δa2\delta_{a^2} so different in size, and yet give a bias near zero?

Part IV — Collinearity of age and experience.

  1. Define experience as a−s−6a - s - 6. Regress yy on a constant, ss, aa and experience. What goes wrong?
  2. Give the rank of the regressor matrix.
  3. Which combinations of the coefficients can still be estimated?
  4. Give the variance inflation factors of ss, aa and a2a^2 in the regression of Part II.
  5. Why is the high VIF of aa and a2a^2 no problem for the coefficient on ss?
  6. With half the sample, by what factor would the standard error of the schooling coefficient grow?
  7. If ability raised income and was positively correlated with schooling, which way would the estimate be biased?
  8. Could controlling for hours worked fix that bias? Could it create another?
  9. State the result: the return to schooling with its interval, and the size of the omitted-variable bias from age.
Solution

Solution of Problem 30.1.

Part I. 1. XX is 1,922×41{,}922 \times 4; row ii is (1,si,ai,ai2)(1, s_i, a_i, a_i^2). 2. 4×44 \times 4; 4×14 \times 1. 3. The number of heads, 1,922; the sum of yiy_i. 4. The estimator is (X′X)−1X′y(X'X)^{-1}X'y; if X′XX'X is singular some coefficients are not identified. 5. The residuals sum to zero. Part II. 6. 0.0580; R2=0.108R^2 = 0.108. 7. 0.0584, interval 0.0518 to 0.0649; R2=0.309R^2 = 0.309, Rˉ2=0.308\bar R^2 = 0.308. 8. Among heads of the same age, a year more schooling goes with gross income about 5.8 per cent higher. 9. The coefficients are 0.0724 on aa and −0.000755-0.000755 on a2a^2; the peak is at 0.0724/(2×0.000755)=480.0724/(2 \times 0.000755) = 48 years. 10. In the survey schooling and age are almost uncorrelated, so leaving age out removes little. Part III. 11. The variance of ss is 6.728, of s~\tilde s 6.712: age predicts almost none of schooling. 12. 0.0584, the long coefficient, as the theorem says. 13. δa=0.318\delta_a = 0.318 and δa2=30.99\delta_{a^2} = 30.99. 14. β^sshort=β^slong+γ^aδ^a+γ^a2δ^a2\hat\beta_s^{\text{short}} = \hat\beta_s^{\text{long}} + \hat\gamma_a\hat\delta_a + \hat\gamma_{a^2}\hat\delta_{a^2}. 15. 0.0724×0.318−0.000755×30.99=0.0230−0.0234=−0.00040.0724 \times 0.318 - 0.000755 \times 30.99 = 0.0230 - 0.0234 = -0.0004; 0.0584−0.0004=0.05800.0584 - 0.0004 = 0.0580, the short coefficient. 16. a2a^2 is measured in squared years, so its coefficients are small and its δ\delta large; the two terms have opposite signs and nearly cancel. Part IV. 17. Experience is an exact linear combination of the constant, ss and aa: XX has rank 3 with 4 columns, and the coefficients are not identified. 18. 3. 19. Only combinations such as βs−βe\beta_s - \beta_e and βa+βe\beta_a + \beta_e: the effect of schooling at a given age, or of age at given schooling; never the three separately. 20. 1.00 for ss, 43.5 for aa and for a2a^2. 21. The VIF of ss is 1.00: ss is almost uncorrelated with aa and a2a^2, and its variance does not depend on how well aa and a2a^2 can be told apart. 22. By about 2=1.41\sqrt2 = 1.41. 23. Upwards: γ>0\gamma > 0 and δ>0\delta > 0. 24. No: hours do not measure ability. They may be a bad control, since schooling may change hours worked. 25. The return to a year of schooling in Brenland is 5.84 per cent (95 per cent interval 5.18 to 6.49) holding age fixed; leaving age out changes it by −0.04-0.04 points, because age and schooling are almost uncorrelated in the survey.

المصطلحات المعرَّفة في هذا الفصل

عرض كل المصطلحات (1086) في المسرد