Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome back to our exploration of the statistical properties of linear regression.
In the last lesson, we established that the Ordinary Least Squares (OLS) estimator is unbiased, meaning that on average, it correctly identifies the true population parameters (). However, being correct on average is not enough. An estimator whose estimates are wildly scattered around the true value is not very useful. We also need our estimator to be precise.
Today, we will quantify this precision. Our learning outcome is to derive the variance-covariance matrix of the OLS estimators. This will give us a formula for the uncertainty associated with our coefficient estimates. This derivation is a cornerstone of econometrics and statistical learning, and your comfort with formal proofs will be key to mastering it.
This lesson directly builds on our unbiasedness proof and sets the stage for the famous Gauss-Markov theorem, which we will tackle next.
1. Defining the Variance-Covariance Matrix
For a single random variable, variance is a scalar that measures its spread. For a vector of random variables, like our estimator , this concept extends to a variance-covariance matrix.
The variance-covariance matrix of a random vector is formally defined as:
Since we proved in the last lesson that , the variance-covariance matrix for our OLS estimator is:
If is a vector, then is and is . Their product is a matrix:
The diagonal elements represent the variance of each individual coefficient estimate, telling us about its precision. The off-diagonal elements represent the covariance between pairs of coefficient estimates, telling us how they vary together.
2. Assumptions about the Error Term's Variance
In our proof of unbiasedness, the critical assumption was the zero conditional mean of the errors (). For deriving the variance, we need an additional set of assumptions concerning the second moment of the errors.
This is Assumption 4 from the Classical Linear Model (CLM) assumptions, which we can revisit in the Stanford notes.
The document 'OLS in Matrix Form' formally states the assumption about the error variance that we need for our derivation. Let's examine it closely.
Please reread the section on Assumption 4, 'E(ϵϵ′|X) = σ²I', on pages 5-6. Pay close attention to how this single matrix equation encapsulates two distinct concepts: homoscedasticity and no autocorrelation.
The assumption can be broken down as follows:
-
Homoscedasticity (Constant Variance): The variance of each error term , conditional on , is a constant value .
These are the diagonal elements of the matrix .
-
No Autocorrelation (or Serial Correlation): Any two different error terms, and , are uncorrelated.
These are the off-diagonal elements of the matrix, which are all zero.
Together, these assumptions mean the variance-covariance matrix of the error vector is a diagonal matrix with on the diagonal, which is concisely written as . These errors are sometimes called spherical disturbances.
3. Derivation of the Variance-Covariance Matrix
With the definition and assumptions in place, we can proceed with the derivation. The process involves matrix algebra and applying the properties of the expectation operator.
To see the derivation unfold, let's start with a video that walks through the steps.
Variance of Least Squares Estimators - Matrix Form
The video 'Variance of Least Squares Estimators - Matrix Form' by Ben Lambert provides a concise and clear derivation. It directly applies the rules of variance for matrices that we will use.
Watch the entire video. Focus on how the expression for the OLS estimator is manipulated and how the assumption Var(Y) = σ²I (which follows from Var(ε) = σ²I) is used to simplify the final expression.
Now, let's formally construct the proof step-by-step. This derivation requires careful application of matrix transpose rules and the properties of expectation.
Step 1: Express the estimation error .
From our previous lesson on unbiasedness, we derived the crucial relationship:
Therefore, the estimation error is:
Step 2: Substitute this into the definition of the variance-covariance matrix.
Step 3: Apply the transpose rule to the second term.
Since is a symmetric matrix, . The expression simplifies to:
Step 4: Substitute back and rearrange.
Step 5: Apply the expectation operator.
We take the expectation conditional on . The terms involving can be treated as non-random and pulled outside the expectation.
Step 6: Apply the assumption of spherical errors.
Now we use our key assumption: .
Step 7: Simplify the expression.
Since is a scalar and is the identity matrix, we can rearrange:
The middle terms cancel out: .
Step 8: Final Result.
This gives us the celebrated formula for the variance-covariance matrix of the OLS estimators:
The handwritten derivation below summarizes this fundamental result.

For a final review, you can see this complete derivation in the Stanford notes, which we've been using as our primary reference.
The section 'The Variance-Covariance Matrix of the OLS Estimates' in the 'OLS in Matrix Form' document provides a concise, formal write-up of the exact proof we just completed.
Please read Section 6 on page 7. Compare the steps in the document (equations 28 through 30) with our derivation to solidify your understanding.
Test your understanding!
Suppose the assumption of no autocorrelation holds, but the errors are heteroskedastic. This means that , where the variance is different for each observation. In this case, the error covariance matrix is a diagonal matrix but not .
What would the formula for look like in this situation? At which step would our derivation change?
Show answer
The derivation would change at Step 6. We could no longer substitute with . Instead, we would have to leave it as a general diagonal matrix .
The formula from Step 5 would be:
This more complex formula is known as the "sandwich estimator". Because the standard OLS formula would be incorrect, the standard errors computed by basic regression software would be wrong, leading to invalid hypothesis tests. This is why testing for heteroscedasticity is a crucial part of applied regression analysis.
4. Interpretation and Estimation
The formula is powerful. It tells us that the precision of our estimates depends on two things:
- : The variance of the unobservable errors. The more "noisy" the underlying process is, the less precise our estimates will be.
- : The data matrix of our regressors. A greater spread in the values of and lower correlation between them (avoiding multicollinearity) leads to a "smaller" inverse matrix, and thus more precise estimates.
There is one practical problem: is an unknown population parameter. We must estimate it from our sample data. The unbiased estimator for is:
where is the vector of sample residuals, is the number of observations, and is the number of parameters (including the intercept). The denominator represents the degrees of freedom.
By plugging this in, we get the estimated variance-covariance matrix:
The square roots of the diagonal elements of this matrix are the standard errors of the OLS coefficients, which you have likely seen in the output of statistical packages. These standard errors are the fundamental building blocks for constructing confidence intervals and conducting t-tests.
Conclusion
In this lesson, we completed a crucial step in understanding the properties of the OLS estimator. By adding the assumptions of homoscedasticity and no autocorrelation, we derived the formula for its variance-covariance matrix.
Key Takeaways:
- The variance of the OLS estimator is a matrix containing the variances of each coefficient on its diagonal and the covariances in the off-diagonal positions.
- The derivation relies on the CLM assumption of spherical errors: .
- The final formula is .
- The precision of OLS estimates depends on the underlying error variance () and the structure of the data ().
- In practice, we use an estimate of the error variance, , to compute the estimated variance-covariance matrix, from which we obtain the standard errors for inference.
Preview of the Next Lesson:
We now have the two main ingredients to evaluate the quality of the OLS estimator: it is unbiased, and we have an expression for its variance. The question remains: is there another linear and unbiased estimator that might have an even smaller variance? In our next lesson, we will prove the Gauss-Markov Theorem, which shows that OLS is, in fact, the Best Linear Unbiased Estimator (BLUE), meaning it has the minimum variance among all estimators in its class.