Many textbooks on linear regression start with a fully-fletched regression model, including assumptions such as independence and homoscedasticity right from the start. I always found this treatment not very intuitive, as many results, such as the unbiasedness of the parameter estimates, hold without making these stronger assumptions. The goal of this post is to introduce the assumptions of the OLS model one by one, and only when they become necessary. The major assumptions are, in the order they are introduced: linearity, no perfect collinearity, zero conditional mean, independence, homoscedasticity, and the normal distribution of errors.

The material is inspired by a number of textbooks, most importantly Gelman and Hill (2006) and Hayashi (2000). The latter is especially helpful, because it is clearly stated which assumptions are needed for which result.

## The basic assumption: Linearity

In a regression model, we model the outcome as a linear function of a number of predictors. The model is of the following form:

We know the outcome, , and the predictors The are unknown, and we want to estimate them from the data. Because we rarely assume that the relationship between and is completely deterministic, we also add an error term, This term captures anything about that is not captured by the predictors. The most important assumption in regression is in this equation: We assume that the relationship between the outcome and the predictors is additive and linear. This assumption can be relaxed somewhat. For instance, we could interact predictors to produce the model

In this model, is no longer a linear function of and . However, the regression model is still linear in the parameters, although we have to pay attention when interpreting the coefficients. The same is true for a model of the form which includes a squared term. If we assume a multiplicative model we could transform this is into a linear model using

## Regression as an optimization problem

We now collect some data, in order to estimate the unknown quantities of this model, the We collect data on the outcome and the predictors To find values for the , first, let’s just guess. For instance, we could roll a die repeatedly and record the results. We call the result to show that we have now estimated . To be sure, this estimate will be pretty bad (we didn’t use any of our data to find it!). To formalize the idea that our made-up ’s will likely be a bad estimate, we compute for each observation the predicted values, :

We use only the deterministic part of the model to compute because, by definition, we do not know Intuitively, if we simply guess the parameter values, the predicted values will have little to do with the actual values . One way to quantify how good or bad our guesses are is to compute a loss function, which is some function that quantifies how much the predicted values deviate from the true, known values. One such loss function is

This loss function, called the squared error loss, is always positive, and ideally, we would like its value to be small. For a random guess, the differences between and will likely be large. A better guess would reduce the value of the loss function. This choice of loss function may seem somewhat arbitrary. For instance, one might ask why we didn’t choose the following loss function:

This is also a very reasonable loss function: it is always positive, and we would like its value to be small. There is an infinite number of other possible loss functions, and in many situations it will be advantageous to choose one of these alternatives. However, the squared error loss has some advantages. Maybe most important of all, its easy to find a closed-form expression for the ’s that minimizes the loss. It is from this choice of loss function that ordinary least *squares* gets its name; but notably, this refers to the estimation method. Nothing in our regression model so far has told us that we require as a loss function, it’s just one way to estimate the parameters .

The goal is now to find a set of parameters that minimize the value of . At this point, it becomes convenient to switch to matrix notation. We arrange the outcome values and the predictors into a column vector , and a matrix , respectively. The first column of is just a vector of 1’s—this way we can include in the parameter vector. The parameters are collected in a column vector .

Through the use of some matrix algebra, we can then rewrite the loss function as

To find the minimum, we differentiate with respect to (this requires a bit of matrix calculus):

Setting this equal to zero, we get

the so-called “normal equations.” The remaining step is to premultiply both sides by the inverse of , from which we obtain

To show that this is really the minimum of , we would need to show that is convex. We skip that step here.

The expression that we derived for is attractive in its simplicity. However, the expression relies on that fact that is invertible. This will only be the case if has full column rank, or, to put it differently, that no two columns in are perfectly correlated. It is also required that i.e. that we have at least as many observations as predictors. If does not have full column rank, we could replace with a pseudo-inverse. However, that inverse won’t be unique, and so the estimates will no longer be unique either. Going forward, we will assume that no two columns in are perfectly correlated.

If we just want to learn about we are done at this point. We made two big assumptions: We assumed that depends linearly on the inputs , and we assumed that no two predictors are perfectly correlated.

## The zero conditional mean assumption

Arguably, until now, the math involved only some optimization, but no statistics. However, in statistics, we also care about uncertainty. For instance, we are often interested in whether some input is associated with the outcome . If , the coefficient for , is zero, we would conclude that there is no association. But might be non-zero just by chance, and so we would like some measure of the uncertainty of .

To do so, we make an assumption about the error term. Currently our model can be written in matrix notation as

We now additionally assume that is a random vector with mean and covariance matrix . The assumption that is specifically zero is not very strict. For instance, we could assume , where is some constant, and then absorb this constant in the coefficient . However, assuming that the mean of the errors is *constant* is a big assumption: Essentially it means that, after we have accounted for the predictors , there is no other systematic variation in .

It is possibly easier to recognize the severity of this assumption by finding the expressions for the mean and variance of . These are now also random variables, as they are functions of . We still assume that the predictors are known and fixed. It is then straightforward to derive the expectation and variance of :

Note that the assumption about is equivalent to assuming that is a random vector with expectation and covariance matrix . We therefore assume that the information we have in is sufficient to model . The zero conditional mean assumption is frequently violated—the most common occurrence is omitted variable bias.

If is a random vector, this also has consequences for our OLS estimator, , which is a function of . Therefore, is a random vector as well. We can derive the expectation of as follows:

Hence, under the present assumptions, is unbiased. To arrive at this result, we had to assume linearity, no perfect collinearity, and (zero conditional mean).

## Standard errors

Next, making use of the fact that for a non-random matrix and random vector , , we find that

This is the expression that we interested in. The diagonal elements of (a matrix) tell us about the uncertainty in estimating the elements of . To estimate the variance, however, we need to know or estimate , and this is where we run into trouble. This matrix will be of the form

This is a symmetric matrix (). We therefore need to estimate variances and covariances, for a total of elements. However, we only have observations in total! Clearly, this won’t work, and we therefore have to make another assumption: First, we will assume that the are independent. We do not assume the are i.i.d., independent and *identically* distributed. The mean of depends on , and therefore two different ’s may have a different mean. We can also state this assumption in terms of the errors, as is also the covariance matrix of . (Strictly speaking, we only require here that the outcomes/errors are uncorrelated, but the independence assumption is more transparent.)

Substantively, the assumption of independence means that we assume , i.e. that the mean of any outcome does not depend on the values of the other outcomes. Depending on the problem, this assumption can be unrealistic, and it can relaxed with techniques such as clustered standard errors or multilevel models. The assumption of independence is sometimes replaced with the assumption that our data is a random sample from a population of interest, but I find the statement that the are independent more precise.

With the independence assumption, the form of is radically simplified, as all off-diagonal values are now zero:

We are left with the variances on the diagonal. Estimating variances with data points might still sounds impossible, but it is routinely done: When using robust or heteroscedasticity-consistent standard errors, the variances of are estimated as (White 1980; but see Freedman 2006 and King and Roberts 2015). However, in the standard regression model, we instead make another assumption: homoscedasticity. This means that we assume that all the have the same variance, which will denote by . Thus,

where is the identity matrix. Now, we only have to estimate one parameter with observations. Before we show how to estimate , we first note that the expression for the variance becomes much simpler when we assume that the covariance matrix of is given by :

It remains to estimate . Under the assumptions made, it can be shown that

is an unbiased estimator for . The expression is just the average error that our model makes in predicting , adjusted for the degrees of freedom that we required to estimate . Hence, for an estimate of the variance of , we can use

and the square root of this expression is, of course, the standard error. If we are just interested in the standard error, we can stop here.

## Conclusion

It turns out that this list is similar the one presented by Gelman and Hill (2006, p. 45f.), who list validity, additivity and linearity, independence of errors, equal variance of errors, and normality of errors as assumptions, in order of their importance. Their list however, adds another major assumption to the front of the list: Validity. In their words,

Most importantly, the data you are analyzing should map to the research question you are trying to answer. This sounds obvious but is often overlooked or ignored because it can be inconvenient. Optimally, this means that the outcome measure should accurately reflect the phenomenon of interest, the model should include all relevant predictors, and the model should generalize to the cases to which it will be applied. (p. 45)

Furthermore, none of the mathematical assumptions guarantee that the regression coefficients can be interpreted as causal.

## References

- Freedman, David A. (2006). “On The So-Called ‘Huber Sandwich Estimator’ and ‘Robust Standard Errors’”. The American Statistician. 60 (4): 299–302. doi:10.1198/000313006X152207.
- Gelman, Andrew and Jennifer Hill. (2006). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press.
- Hayashi, Fumio. (2000). Econometrics. Princeton University Press.
- King, Gary; Roberts, Margaret E. (2015). “How Robust Standard Errors Expose Methodological Problems They Do Not Fix, and What to Do About It”. Political Analysis. 23 (2): 159–179. doi:10.1093/pan/mpu015.
- White, Halbert (1980). “A Heteroscedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroscedasticity”. Econometrica. 48 (4): 817–838. doi:10.2307/1912934.

]]>