Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Economics

11 Regression

National Graduate Institute for Policy Studies (GRIPS)

11.1Linear Regression

Linear regression is one of the core topics of statistics. It is even more central to econometrics, where a shortage of controlled experiments often leaves econometricians trying to factor heterogeneity out ex post. We begin with a nontraditional view of linear regression based on minimal assumptions.

11.1.1The Setup

Let’s start with the kind of prediction problem discussed in Section 8.2.2. We study a system with vector input xn∈RK\boldx_n \in \RR^K followed by scalar output yny_n. For example,

Although we don’t exclude the possibility that yy is categorical (i.e., discrete), our loss function will be oriented toward regression (where yy takes values in R\RR).

Suppose that we have NN observations zn:=(xn,yn)\boldz_n := (\boldx_n,y_n), all of which are draws from some fixed joint distribution PP. Since PP is fixed, we are assuming that the system is stationary across the set of draws. Our aim is to predict new output values from input values on the basis of this data. In particular, our problem is to

choose a function f ⁣:RK→R such that f(x) is a good predictor of y\text{choose a function } f \colon \RR^K \to \RR \text{ such that } f(\boldx) \text{ is a good predictor of } y

To define "good predictor" mathematically, we need a loss function. Throughout this chapter we will be using quadratic loss. Thus, in the language of Section 8.2.2, our aim is to minimize the prediction risk

R(f):=EP (y−f(x))2R(f) := \EEP (y - f(\boldx))^2

As we saw in Section 5.2.5, the minimizer of (11.2) over the set of all B\bB-measurable functions is the regression function f∗(x):=EP [y ∣ x]f^*(\boldx) := \EEP [y \given \boldx]. If we could compute this, then all our problems would be solved. But we cannot compute it because PP is not known. Instead we apply the principle of empirical risk minimization (see Section 8.2.2), which leads to the problem

min⁡f∈HRemp(f)whereRemp(f):=1N∑n=1N(yn−f(xn))2\min_{f \in \hH} \Remp(f) \quad \text{where} \quad \Remp(f) := \frac{1}{N} \sum_{n=1}^N (y_n - f(\boldx_n))^2

Here H\hH is the hypothesis space, a set of candidate functions mapping RK\RR^K into R\RR. For obvious reasons, the problem (11.3) is called a least squares problem.

If we take H\hH to be the set of all functions from RK\RR^K to R\RR, then, provided the input vectors are all distinct, we can set the empirical risk Remp(f)\Remp(f) to zero by choosing any function ff satisfying yn=f(xn)y_n = f(\boldx_n) for all nn. However, as discussed at length in Section 8.2.3, minimizing empirical risk is different from minimizing the prediction risk R(f)R(f). The latter is what we actually want to minimize. Thus H\hH must be restricted.

In this chapter we consider the case H=Hℓ\hH = \llL, where Hℓ\llL is all linear functions from RK\RR^K to R\RR. Recalling theorem 3.1.1, we can write

Hℓ={ all f ⁣:RK→R  such that f(x)=x⊺b for some b∈RK}\llL = \left\{ \, \text{all } f \colon \RR^K \to \RR \, \text{ such that } f(\boldx) = \boldx^\T \boldb \text{ for some } \boldb \in \RR^K \right\}

The problem (11.3) then reduces to

min⁡b∈RK  ∑n=1N(yn−xn⊺b)2\min_{\boldb \in \RR^K} \; \sum_{n=1}^N (y_n - \boldx_n^\T \boldb)^2

The term 1N\frac{1}{N} has been dropped because it does not affect the minimizer. This is the multivariate version of (8.22).

The idea of choosing b\boldb to minimize (11.5) is intuitive: We are choosing a "line of best fit" to minimize in-sample prediction error. This optimization problem has a long tradition. It dates back at least as far as Carl Gauss’s work on the orbital position of Ceres, published in 1801.

You might be wondering whether the choice H=Hℓ\hH = \llL is a suitable one. This is an excellent question. It might not be. However, there are good reasons to start with Hℓ\llL, even in this setting where no linearity assumptions are imposed. First, Hℓ\llL is a natural starting point when seeking a class of simple, well-behaved functions. Second, as we’ll see, setting H=Hℓ\hH = \llL allows us to obtain an analytical expression for the minimizer, which simplifies both analysis and computation. Third, the technique has an extension from Hℓ\llL to broader classes of functions, as described in Section 11.2.1.

11.1.2The Least Squares Estimator

Now let’s solve (11.5). With our knowledge of overdetermined systems (see Section 3.3.2), we already have all the necessary tools. This will be more obvious after we switch to matrix notation. To do this, let

y:=(y1y2⋮yN),xn:=(xn1xn2⋮xnK)= nth observation of all regressors\boldy := \left( \begin{array}{c} y_1 \\ y_2 \\ \vdots \\ y_N \end{array} \right), \quad \boldx_n := \left( \begin{array}{c} x_{n1} \\ x_{n2} \\ \vdots \\ x_{nK} \end{array} \right) = \text{ } n \text{th observation of all regressors}

and

X:=(x1⊺x2⊺⋮xN⊺):=:(x11x12⋯x1Kx21x22⋯x2K⋮⋮⋮xN1xN2⋯xNK)\boldX := \left( \begin{array}{c} \boldx_1^\T \\ \boldx_2^\T \\ \vdots \\ \boldx_N^\T \end{array} \right) :=: \left( \begin{array}{cccc} x_{11} & x_{12} & \cdots & x_{1K} \\ x_{21} & x_{22} & \cdots & x_{2K} \\ \vdots & \vdots & & \vdots \\ x_{N1} & x_{N2} & \cdots & x_{NK} \end{array} \right)

Sometimes X\boldX is called the design matrix. By construction, col⁡kX=\col_k \boldX = all observations on the kkth regressor. Also, for any b∈RK\boldb \in \RR^K, we have

Xb=(x1⊺bx2⊺b⋮xN⊺b)\boldX \boldb = \left( \begin{array}{c} \boldx_1^\T \boldb \\ \boldx_2^\T \boldb\\ \vdots \\ \boldx_N^\T \boldb \end{array} \right)

It follows that the objective function in (11.5) can be written as

∑n=1N(yn−xn⊺b)2=∥y−Xb∥2\sum_{n=1}^N (y_n - \boldx_n^\T \boldb)^2 = \| \boldy - \boldX \boldb \|^2

Since strictly increasing transforms preserve the set of minimizers (see Section 15.4),

argmin⁡b∈RK∥y−Xb∥2=argmin⁡b∈RK∥y−Xb∥\argmin_{\boldb \in \RR^K} \| \boldy - \boldX \boldb \|^2 = \argmin_{\boldb \in \RR^K} \| \boldy - \boldX \boldb \|

We already know how to solve for the minimizer on the right-hand side of (11.8). By theorem 3.3.2, the solution is

β^:=(X⊺X)−1X⊺y\hboldbeta := (\boldX^\T \boldX)^{-1} \boldX^\T \boldy

Traditionally, this random vector β^\hboldbeta is called the least squares estimator. Once we move to more classical assumptions it will be an estimator of a particular parameter vector. At this stage it just defines our answer to the problem posed in (11.1). That is,

given x∈RK, our prediction of y is f(x)=x⊺β^\text{given } \boldx \in \RR^K \text{, our prediction of } y \text{ is } f(\boldx) = \boldx^\T \hboldbeta

In terms of geometric interpretation, since Xβ^\boldX \hboldbeta solves (11.8), it is the closest point in colspace⁡X\colspace \boldX to y\boldy. In particular,

Py=Xβ^whenP:=proj⁡ (colspace⁡X)\boldP \boldy = \boldX \hboldbeta \quad \text{when} \quad \boldP := \proj \, (\colspace \boldX )

(See (3.13).) In what follows, M\boldM is the residual projection, as defined in (2.11).

11.1.2.1Assumptions

Theorem 3.3.2 and our definition of β^\hboldbeta in (11.9) require that X\boldX has full column rank (or, equivalently, that the columns of X\boldX are linearly independent—see page ).

By theorem 2.1.3, N⩾KN \geq K is a necessary condition for assumption 11.1.1 to hold. (If N<KN < K, then RN\RR^N, which is necessarily spanned by NN vectors, cannot contain KK linearly independent vectors.)

If assumption 11.1.1 fails, then a minimizer of (11.8) still exists but is no longer unique (see ex. 3.5.34). While we can treat this case, it rarely occurs in well-designed regression problems.

Let’s also put some mild regularity conditions on the common joint distribution PP of each data point zn:=(xn,yn)\boldz_n := (\boldx_n, y_n).

Finite second moments are imposed because we want to evaluate expected squared errors. This assumption cannot be weakened unless we are willing to work with a different loss function. Positive definiteness of Σx\Sigmax ensures that the asymptotic limit of our estimator is well defined.[1]

11.1.2.2Notation

There’s a range of standard notation associated with linear least squares estimation. Let’s collect it in one place. First, the projection

y^:=Xβ^=Py\hboldy := \boldX \hboldbeta = \boldP \boldy

is called the vector of fitted values. The nnth fitted value y^n\hat y_n is the prediction xn⊺ β^\boldx_n^\T \, \hboldbeta associated with least squares estimate and the nnth observation xn\boldx_n of the input vector. The vector My\boldM \boldy is often denoted u^\hboldu, and called the vector of residuals:

u^:=My=y−y^\hboldu := \boldM \boldy = \boldy - \hboldy

The vector of residuals corresponds to the error that occurs when y\boldy is approximated by Py\boldP \boldy. From fact 2.2.8 we have

My⊥Pyandy=Py+My\boldM \boldy \perp \boldP \boldy \quad \text{and} \quad \boldy = \boldP \boldy + \boldM \boldy

In other words, y\boldy can be decomposed into two orthogonal vectors Py\boldP \boldy and My\boldM \boldy, where the first represents the best approximation to y\boldy in colspace⁡X\colspace \boldX, and the second represents the residual.

Related to the fitted values and residuals, we have some standard definitions:

By (11.11) and the Pythagorean law,

TSS=ESS+RSS\tss = \ess + \rss

When running regressions it is conventional to report the coefficient of determination, or R2R^2. The plain vanilla definition of R2R^2 is

R2:=ESSTSSR^2 := \frac{\ess}{\tss}

Many regression packages report an alternative definition of R2R^2. See Section 11.2.3 below.

11.1.3Out-of-Sample Fit

We have stressed a number of times that learning from data (statistics) means generalization from current observations to new ones. As such, the most important measure of success for a statistical procedure is out-of-sample fit. So how does linear least squares perform out-of-sample? We start with a general observation about linear predictors.

Here f∗f^* is the regression function and b∗=Σx−1 E [x y]\boldb^* = \Sigmax^{-1} \, \EE[\boldx \, y] is the vector of coefficients in the best linear predictor . R(f)R(f) is the prediction risk of ff and expectations are taken under the unknown joint distribution PP of the pairs (x,y)(\boldx, y).

The proof of theorem 11.1.1 is given in Section 11.1.3.1. For now let’s look at interpretation. The general question is how well we can generalize (i.e., reduce prediction risk) using linear functions. Theorem 11.1.1 decomposes the prediction risk of an arbitrary linear predictor ℓ(x)=x⊺b\ell (\boldx) = \boldx^\T \boldb into three terms:

  1. The intrinsic risk E (y−f∗(x))2\EE (y - f^*(\boldx))^2.

  2. The approximation error E (f∗(x)−x⊺b∗)2\EE (f^*(\boldx) - \boldx^\T \boldb^*)^2.

  3. The estimation error (b∗−b)⊺Σx(b∗−b)(\boldb^* - \boldb)^\T \Sigmax (\boldb^* - \boldb).

The intrinsic risk is also called Bayes risk (see example 8.2.3). It is the residual error after yy is approximated with the best possible predictor (i.e., the regression function). It is large to the extent that yy is hard to predict using x\boldx.

The approximation error or bias is the deviation between the best predictor and the best linear predictor. It reflects the cost of our decision to approximate the regression function using a linear architecture. If this architecture is held fixed, the approximation error is also fixed and cannot be reduced in the estimation process.

The estimation error is caused by the deviation of our estimator from the best linear predictor b∗\boldb^*. This deviation occurs because we are predicting using finite sample information on the joint distribution of (x,y)(\boldx, y).

Theorem 11.1.1 tells us that once H\hH is set to the class of linear functions, the best we can do is find an estimation method (a learning algorithm) that produces an estimate that is close to b∗\boldb^* on average when the sample size is sufficiently large. The next result states that the least squares estimator β^\hboldbeta has this property.

The proof is below. Independence is required only for the LLN to function. We could weaken this to ergodicity (see Section 7.1.1) and obtain the same conclusion.[2]

On one level, theorems 11.1.1 and 11.1.2 are reassuring. They tell us that if the underlying process is relatively linear, then we will attain small risk asymptotically. On the other hand, the Glivenko–Cantelli theorem tells us that we can learn everything about the underlying distribution in the limit. Here we are bounded away from this kind of consistency whenever the approximation error is positive.

As will be discussed in chapter 14, a general principle of induction is that we should introduce bias in finite samples to avoid overfitting, while at the same time reducing bias asymptotically, as the empirical distribution converges to the true distribution. By comparison, in standard linear regression the bias is held fixed by the linearity assumption.

11.1.3.1Proofs

11.1.4In-Sample Fit

In-sample fit measures how well a given model fits the same data set that it was estimated on. The difference between in-sample fit (empirical risk) and out-of-sample fit (risk) was discussed in Section 8.2.3. In-sample fit of a regression is often measured with R2R^2 (see (11.13)). Let’s make some further comments on R2R^2 and then discuss how R2R^2 relates to in-sample fit.

That R2⩽1R^2 \leq 1 is immediate from ∥Py∥⩽∥y∥\| \boldP \boldy \| \leq \| \boldy \| (cf. theorem 2.2.2). Exercise 11.4.17 asks you to prove the second claim. More generally, a high R2R^2 indicates y\boldy is relatively close to colspace⁡X\colspace \boldX. This fact suggests that we can increase R2R^2 at least weakly by adding regressors. As we do so the column space of X\boldX expands, pushing out towards y\boldy. Here’s a formal statement:

For a proof, see exercise 11.4.8 and its solution.

High R2R^2 is sometimes equated with successful regression. This is a misunderstanding of the aim of statistics. The correct definition of statistical learning is effective generalization from existing data. In the present context this means that the linear predictor produced by regression attains low risk.

So how does R2R^2 relate to risk? What R2R^2 actually measures is the degree to which empirical risk is minimized. To see this, note that

R2=1−RSSTSS=1−NRemp(f^)TSSR^2 = 1 - \frac{\rss}{ \tss } = 1 - N \frac{\Remp(\hat f) }{\tss}

where Remp\Remp is as defined in (11.3) and f^\hat f is our linear predictor f^(x)=x⊺β^\hat f(\boldx) = \boldx^\T \hboldbeta. Thus high R2R^2 means low empirical risk and good in-sample fit. But low empirical risk is no guarantee of low prediction risk, as was emphasized in Section 8.2.3.

Here’s a simulation that shows how we can produce high R2R^2 without estimating anything meaningful. We take xnx_n and yny_n as independent draws from a uniform distribution on [0,1][0,1]. By construction, there is no relationship between these two variables. For the regressors we take the powers 1,x,x2,…,xK1, x, x^2, \ldots, x^K, where KK is a positive integer. The R code below runs these regressions for different values of KK. At K=25K=25 the value of R2R^2 is around 0.95. This is despite the fact that no relationship exists between xx and yy.


set.seed(1234)
N <- 25
y <- runif(N)
x <- runif(N)
X <- rep(1, N)

Kmax <- 25
for (K in 1:Kmax) {
    X <- cbind(X, x^K)
    results <- lm(y ~ 0 + X)
    Py2 <- sum(results$fitted.values^2)
    y2 <- sum(y^2)
    cat("K =", K, "R^2 =", Py2 / y2, "\n")
}

To finish this section, let’s draw a connection between fact 11.1.2, which says that the value of R2R^2 is at least weakly increasing in the number of right-hand side variables, and fact 8.2.1. Suppose that x\boldx lists a large number of possible regressors. Let the hypothesis space be

Hj:={all f ⁣:Rj→R  s.t.  f(x)=x⊺b for some b∈Rj}\hH_j := \left\{ \text{all } f \colon \RR^j \to \RR \st f(\boldx) = \boldx^\T \boldb \text{ for some } \boldb \in \RR^j \right\}

Here 1⩽j⩽K1 \leq j \leq K. Empirical risk minimization over Hj\hH_j is equivalent to linear regression over the first jj regressors. Empirical risk falls as jj increases by fact 8.2.1. Hence R2R^2 increases. This is the same conclusion as fact 11.1.2.

11.2The Geometry of Least Squares

In this section we cover transformations of the data and an important theorem on subsets of the least squares estimator.

11.2.1Transformations and Basis Functions

In discussing the decision to set H=Hℓ\hH = \llL in Section 11.1.1, we mentioned that we can use many of the same ideas when extending H\hH to a broader class of functions. The idea is to first transform the data using some arbitrary function ϕ ⁣:RK→RJ\boldphi \colon \RR^K \to \RR^J. The action of ϕ\boldphi on x∈RK\boldx \in \RR^K is

x↦ϕ(x)=(ϕ1(x)ϕ2(x)⋮ϕJ(x))∈RJ\boldx \mapsto \boldphi(\boldx) = \left( \begin{array}{c} \phi_1(\boldx) \\ \phi_2(\boldx) \\ \vdots \\ \phi_J(\boldx) \end{array} \right) \in \RR^J

The individual functions ϕ1,…,ϕJ\phi_1, \ldots, \phi_J mapping RK\RR^K into R\RR are sometimes called basis functions. In machine learning texts, the range of ϕ\boldphi is called feature space. Linear least squares is now applied in feature space. That is, we solve the empirical risk minimization problem when the hypothesis space is

Hϕ:={all functions ℓ∘ϕ, where ℓ is a linear function from RJ to R}\hH_{\boldphi} := \{ \text{all functions } \ell \circ \boldphi, \text{ where } \ell \text{ is a linear function from } \RR^J \text{ to } \RR \}

The empirical risk minimization problem is then

min⁡ℓ  ∑n=1N{yn−ℓ(ϕ(xn))}2=min⁡γ∈RJ  ∑n=1N(yn−γ⊺ϕ(xn))2\min_{\ell } \; \sum_{n=1}^N \{ y_n - \ell(\boldphi(\boldx_n)) \}^2 = \min_{\boldgamma \in \RR^J} \; \sum_{n=1}^N (y_n - \boldgamma^\T \boldphi(\boldx_n))^2

Switching to matrix notation, if

Φ:=(ϕ1(x1)⋯ϕJ(x1)ϕ1(x2)⋯ϕJ(x2)⋮⋯⋮ϕ1(xN)⋯ϕJ(xN))∈RN×J\boldPhi := \left( \begin{array}{ccc} \phi_1(\boldx_1) & \cdots & \phi_J(\boldx_1) \\ \phi_1(\boldx_2) & \cdots & \phi_J(\boldx_2) \\ \vdots & \cdots & \vdots \\ \phi_1(\boldx_N) & \cdots & \phi_J(\boldx_N) \\ \end{array} \right) \in \RR^{N \times J}

then the objective in (11.19) can be expressed as ∥y−Φγ∥2\| \boldy - \boldPhi \boldgamma \|^2. Since increasing functions don’t affect minimizers, the problem becomes

argmin⁡γ∈RJ∥y−Φγ∥\argmin_{\boldgamma \in \RR^J} \| \boldy - \boldPhi \boldgamma \|

Assuming that Φ\boldPhi is full column rank, the solution is

γ^:=(Φ⊺Φ)−1Φ⊺y\hboldgamma := (\boldPhi^\T \boldPhi)^{-1} \boldPhi^\T \boldy

Figure 11.1 and Figure 11.2 help illustrate how transformations can reduce approximation error. In figure 11.1 it is clear that no linear function mapping xx to yy can produce small approximation error. Figure 11.2 shows the data after applying the transformation R∋x↦ϕ(x):=(x,x3)⊺∈R2\RR \ni x \mapsto \boldphi(x) := (x, x^3)^\T \in \RR^2. The plane drawn in figure 11.2 represents a linear function ℓ ⁣:R2→R\ell \colon \RR^2 \to \RR. The composition ℓ∘ϕ\ell \circ \boldphi has low approximation error. The two figures illustrate how nonlinear data can become linear when projected into higher dimensions.

Nonlinear relationship between x and y

Figure 11.1:Nonlinear relationship between xx and yy

Approximate linearity after projecting the data to \RR^2

Figure 11.2:Approximate linearity after projecting the data to R2\RR^2

Below, when yy is regressed on x\boldx, we can imagine that the data have already been transformed, and x\boldx is the result. Hence we use X\boldX to denote the design matrix instead of Φ\Phi without loss of generality.

11.2.2The Frisch–Waugh–Lovell Theorem

The Frisch–Waugh–Lovell (FWL) theorem yields an expression for an arbitrary sub-vector of the least squares estimator β^\hboldbeta obtained by regressing y\boldy on X\boldX. In stating the theorem, we continue with the assumptions of Section 11.1. Let y\boldy and X\boldX be given and let β^\hboldbeta be as in (11.9). In addition, let K1K_1 be an integer with 1⩽K1<K1 \leq K_1 < K, and let

As exercise 11.4.22 asks you to show, the expression for β^2\hboldbeta_2 in theorem 11.2.1 can be rewritten as

β^2=[(M1X2)⊺M1X2]−1(M1X2)⊺M1y\hboldbeta_2 = [(\boldM_1\boldX_2)^\T \boldM_1 \boldX_2]^{-1} (\boldM_1 \boldX_2)^\T \boldM_1 \boldy

Close inspection of this formula confirms the following claim: There is another way to obtain β^2\hboldbeta_2 besides just regressing y\boldy on X\boldX and then extracting the last K2K_2 elements: we can also regress M1y\boldM_1 \boldy on M1X2\boldM_1 \boldX_2 to produce the same result.

To get some feeling for what this means, let’s look at a special case, where X2\boldX_2 is the single column col⁡KX\col_K \boldX, containing the observations on the KKth regressor. To tie into this notation let’s write X1\boldX_1 as X−K\boldX_{-K} to remind us that it stands for all columns of X\boldX expect the KKth one, and similarly for M1\boldM_1. In view of the preceding discussion, the least squares estimate β^K\hat \beta_K can be found by regressing

y~:=M−Ky=residuals of regressing y on X−K\tilde \boldy := \boldM_{-K} \boldy = \text{residuals of regressing } \boldy \text{ on } \boldX_{-K}

on

x~K:=M−Kcol⁡KX=residuals of regressing col⁡KX on X−K\tilde \boldx_K := \boldM_{-K} \col_K \boldX = \text{residuals of regressing } \col_K \boldX \text{ on } \boldX_{-K}

Loosely speaking, these two residual terms y~\tilde \boldy and x~K\tilde \boldx_K can be thought of as the parts of y\boldy and col⁡KX\col_K \boldX that are “not explained by” X−K\boldX_{-K}. Thus, on an intuitive level, the process for obtaining the least squares estimate β^K\hat \beta_K is as follows:

  1. Remove effects of all other regressors from y\boldy and col⁡KX\col_K \boldX, producing y~\tilde \boldy and x~K\tilde \boldx_K.

  2. Regress y~\tilde \boldy on x~K\tilde \boldx_K.

This is obviously different from the process for obtaining the coefficient of the vector col⁡KX\col_K \boldX in a simple univariate regression, the latter being just

  1. Regress y\boldy on col⁡KX\col_K \boldX.

In words, the difference between the univariate least squares estimated coefficient of the KKth regressor and the multiple regression least squares coefficient is that the multiple regression coefficient β^K\hat \beta_K measures the isolated relationship between xKx_K and yy, without taking into account indirect channels involving other variables.

We can illustrate this idea further with a small simulation. Suppose that

y=x1+x2+uwhereu∼IIDN(0,1)y = x_1 + x_2 + u \quad \text{where} \quad u \iidsim \nN(0,1)

If we generate NN independent observations from this model and regress yy on the observations of (x1,x2)(x_1, x_2), then, provided that NN is sufficiently large, the coefficients for x1x_1 and x2x_2 will both be close to unity (see theorem 11.1.2). However, if we regress yy on x1x_1 alone, then the coefficient for x1x_1 will depend on the relationship between x1x_1 and x2x_2. For example:

> N <- 1000
> x1 <- runif(N)
> x2 = 10 * exp(x1) + rnorm(N)
> y <- x1 + x2 + rnorm(N)
> results <- lm(y ~ 0 + x1)
> results$coefficients
      x1 
      30.83076 

Here the coefficient for x1x_1 is much larger than unity, because an increase in x1x_1 tends to have a large positive effect on x2x_2, which in turn increases yy. The coefficient in the univariate regression reflects this total effect.

11.2.2.1Application: Simple Regression

Here’s an easy application of the FWL theorem: deriving the familiar expression for the slope coefficient in simple linear regression (see Section 8.2.1.1) from the multivariate expression. Simple linear regression is a special case of multivariate regression when 1\boldone is the first column of X\boldX and K=2K = 2. In this section, the second column of X\boldX will be denoted by x\boldx. As we saw in (8.14), the least squares estimates are

β^2=∑n=1N(xn−xˉ)(yn−yˉ)∑n=1N(xn−xˉ)2andβ^1=yˉ−β^2xˉ\hat \beta_2 = \frac{\sum_{n=1}^N (x_n - \bar x)(y_n - \bar y)} {\sum_{n=1}^N (x_n - \bar x)^2} \quad \text{and} \quad \hat \beta_1 = \bar y - \hat \beta_2 \bar x

where xˉ\bar x is the sample mean of x\boldx and yˉ\bar y is the sample mean of y\boldy. We can rewrite the slope coefficient β^2\hat \beta_2 more succinctly as

β^2=[(x−xˉ1)⊺(x−xˉ1)]−1(x−xˉ1)⊺(y−yˉ1)\hat \beta_2 = [(\boldx - \bar x \boldone)^\T(\boldx - \bar x \boldone)]^{-1} (\boldx - \bar x \boldone)^\T(\boldy - \bar y \boldone)

By the FWL theorem (equation (11.25)), we also have

β^2=[(Mcx)⊺Mcx]−1(Mcx)⊺Mcy\hat \beta_2 = [(\boldM_c\boldx)^\T \boldM_c \boldx]^{-1} (\boldM_c \boldx)^\T \boldM_c \boldy

where Mc\boldM_c is the residual projection associated with the linear subspace S=span⁡{1}S = \Span\{\boldone\}, as defined in (3.10). For this residual projection Mc\boldM_c and any z\boldz, we have Mcz=z−zˉ1\boldM_c \boldz = \boldz - \bar z \boldone. Hence the right-hand sides of (11.28) and (11.29) coincide.

11.2.3Centered Observations

Let’s generalize the preceding discussion to the case where there are multiple nonconstant regressors. The only difference is that instead of one column x\boldx of observations on a single nonconstant regressor, we have a matrix X2\boldX_2 containing multiple columns, each a vector of observations on a nonconstant regressor. If the least squares estimate β^\hboldbeta is partitioned into (β^1,β^2)(\hat \beta_1, \hboldbeta_2), then we can write

Xβ^=1β1+X2β^2\boldX \hboldbeta = \boldone \beta_1 + \boldX_2 \hboldbeta_2

Applying the FWL theorem (equation (11.25)) once more, we can write β^2\hboldbeta_2 as

β^2=[(McX2)⊺McX2]−1(McX2)⊺Mcy\hboldbeta_2 = [(\boldM_c\boldX_2)^\T \boldM_c \boldX_2]^{-1} (\boldM_c \boldX_2)^\T \boldM_c \boldy

where Mc\boldM_c is the residual projection in (3.10). As we saw in the last section, Mcy\boldM_c \boldy is y\boldy centered around its mean. Similarly, McX2\boldM_c\boldX_2 is a matrix formed by taking each column of X2\boldX_2 and centering it around its mean. It follows that in a least squares regression with an intercept, the estimated coefficients of the nonconstant regressors are equal to the estimated coefficients of a zero-intercept regression performed after all variables have been centered around their mean.

Let’s use some related ideas to discuss an alternative to the coefficient of determination introduced in (11.13). There are several versions of R2R^2 reported in common regression packages. One of these is so called centered R2R^2. The version in (11.13) will henceforth be called the uncentered R2R^2 for clarity.

One motivation for introducing an alternative to uncentered R2R^2 is that it fails to be invariant to certain changes of units. While it is invariant to changes of units that involve rescaling of the regressand y\boldy (see ex. 11.4.2), it is not invariant to changes of units that involve addition or subtraction (actual inflation versus inflation in excess of a certain level, income versus income over a certain threshold, etc.) whenever X\boldX contains an intercept. Exercise 11.4.3 asks you to prove this.

This is one reason many econometricians use the centered R2R^2 rather than R2R^2, at least when the regression contains an intercept. For the purposes of this section, let’s assume that this is the case (or, more generally, that 1∈colspace⁡X\boldone \in \colspace \boldX). Centered R2R^2 is defined as

Rc2:=∥PMcy∥2∥Mcy∥2=∥McPy∥2∥Mcy∥2R_c^2 := \frac{\| \boldP \boldM_c \boldy \|^2}{\| \boldM_c \boldy \|^2} = \frac{\| \boldM_c \boldP \boldy \|^2}{\| \boldM_c \boldy \|^2}

Mc\boldM_c is as defined in (3.10). The equality of the two expressions for Rc2R^2_c is left as an exercise (ex. 11.4.6). Adding a constant to each element of y\boldy will have no effect on Rc2R^2_c because Mc\boldM_c maps constant vectors to 0\boldzero (see example 3.3.1).

Centered R2R^2 can be rewritten (ex. 11.4.7) as

Rc2=∑n=1N(y^n−yˉ)2∑n=1N(yn−yˉ)2R_c^2 = \frac{ \sum_{n=1}^N (\hat y_n - \bar y )^2 } { \sum_{n=1}^N (y_n - \bar y )^2 }

It is a further exercise (ex. 11.4.5) to show that, in the case of the simple regression, the Rc2R_c^2 is equal to the square of the sample correlation between the regressor and regressand, as defined in (8.5). Thus Rc2R_c^2 is a measure of correlation.

11.3Further Reading

For additional references on the material covered in this chapter see, for example, Friedman et al. (2009), Ruud (2000), Cameron & Trivedi (2005), or Davidson & MacKinnon (2004).

11.4Exercises

11.4.1Solutions to Selected Exercises

Footnotes
  1. In essence, positive definiteness of Σx\Sigmax requires that no random variable in x\boldx can be written as a linear combination of other variables in x\boldx. See exercise 11.4.1.

  2. Later, in Section 13.1, we’ll do something similar (i.e., weaken independence to ergodicity) in a setting with some additional structure.

  3. See, for example, Hong & White (1995), Sun (2011), or Chen & Christensen (2015).

  4. Hint: Use the symmetry and idempotence of the matrix M1\boldM_1.

References
  1. Peysakhovich, A., & Naecker, J. (2015). Machine learning and behavioral economics: evaluating models of choice under risk and ambiguity [Techreport].
  2. McKernan, S.-M., Ratcliffe, C., Steuerle, E., & Zhang, S. (2014). Disparities in wealth accumulation and loss from the great recession and beyond. American Economic Review, 104(5), 240–244.
  3. Auffhammer, M., & Wolfram, C. D. (2014). Powering up China: income distributions and residential electricity consumption. American Economic Review, 104(5), 575–580.
  4. Friedman, J., Hastie, T., & Tibshirani, R. (2009). The Elements of Statistical Learning (2nd ed.). New York: Springer.
  5. Ruud, P. A. (2000). An Introduction to Classical Econometric Theory. Oxford: Oxford University Press.
  6. Cameron, A. C., & Trivedi, P. K. (2005). Microeconometrics: Methods and Applications. Cambridge, UK: Cambridge University Press.
  7. Davidson, R., & MacKinnon, J. G. (2004). Econometric Theory and Methods. Oxford: Oxford University Press.
  8. Hong, Y., & White, H. (1995). Consistent specification testing via nonparametric series regression. Econometrica, 63(5), 1133–1159.
  9. Sun, Y. (2011). Robust trend inference with series variance estimator and testing-optimal smoothing parameter. Journal of Econometrics, 164(2), 345–366.
  10. Chen, X., & Christensen, T. M. (2015). Optimal uniform convergence rates and asymptotic normality for series estimators under weak dependence and weak conditions. Journal of Econometrics, 188, 447–465.