The first lesson chose coefficients by minimising squared residuals and described what holds for every fit. This one writes the whole thing in matrices, which is how every later result is proved and how the entrance exams state it. It asks the two questions behind everything in econometrics: is the estimator centred on the truth, and how spread out is it? And it says exactly what “best” means in the phrase best linear unbiased estimator.
The Ashanagar survey is invented. The statistics modules used one district of 60 households. Econometrics needs more households and more variables, so this is a new, larger survey of 600 households in the same imaginary district: income, spending, household size, whether the household is in the town or a village, the head’s schooling and earnings.
Because we wrote the data-generating process, we know the true answers, and every lab can show whether a regression recovers them. Household spending, in thousands of rupees a month, was generated as 1 + 0.45 × income + 0.9 × household size + 1.5 × town + an error with standard deviation 2.5. A real survey never tells you its true coefficients. This one does, so you can see how close an estimate comes.
It also holds a variable, the head’s ability, that a real survey could not observe. It is kept so that the lessons on omitted variables can show what happens when it is left out. Every figure here is illustrative, not official statistics.
Stack the n observations. Put the dependent variable in a column y, with n rows. Put the regressors in a matrix X, with a column of ones for the intercept and then one column per regressor, so X has n rows and k + 1 columns. Collect the coefficients in a column β with k + 1 rows, and the errors in a column u with n rows. The whole model is one line:
The estimator is the normal equations X′X b = X′y, solved. It is nothing mysterious: X′X collects sums of squares and cross-products of the regressors, X′y collects their cross-products with y, and b is what you get by dividing one by the other, the matrix way. The stepper below does the whole calculation on five households, in exact fractions. Change any number, switch on a second regressor, and then press Try z = 2x to see what happens when one regressor is a multiple of another.
Five households: x is the head’s years of schooling, y is monthly earnings in thousands of rupees. Edit any number (whole numbers from -30 to 40).
| Household | x | y | Fitted | Residual |
|---|---|---|---|---|
| 1 | 8.6 | 0.4 | ||
| 2 | 11.5 | −0.5 | ||
| 3 | 14.4 | 0.6 | ||
| 4 | 17.3 | −1.3 | ||
| 5 | 20.2 | 0.8 |
X has a column of ones for the intercept, then one column per regressor, so it is 5 × 2. y is 5 × 1.
| 1 | 6 |
| 1 | 8 |
| 1 | 10 |
| 1 | 12 |
| 1 | 14 |
| 9 |
| 11 |
| 15 |
| 16 |
| 21 |
Entry (i, j) is the sum, over households, of column i times column j. The corner is n = 5, and the next entry in the first row is Σx = 50.
| 5 | 50 |
| 50 | 540 |
| 72 |
| 778 |
Exact fractions. Multiply it by X′X and you get the identity.
| 27/10 | −1/4 |
| −1/4 | 1/40 |
| −1/10 |
| 29/20 |
So the fitted line is ŷ = −0.1 + 1.45 x.
Σ(residual × 1) = 0; Σ(residual × x) = 0. That is what the normal equations X′(y − Xb) = 0 say.
X′X and invertibility. The corner entry of X′X is n, the first row holds the sums of each regressor, and the rest are sums of squares and cross-products. X′X has an inverse exactly when no column of X is an exact combination of the others. That rules out two regressors that are multiples of each other, a dummy for every category together with an intercept, and, in a simple regression, an x that takes the same value in every household (CUET 2023: the values of the explanatory variable must not all be the same). The assumption is called no perfect collinearity, or full column rank.
The hat matrix and the residual maker. Two matrices built from X do all the work in later proofs:
Idempotent means that applying the operation twice changes nothing: once y has been projected on the regressors, projecting again leaves it where it is. Two traces matter. The trace of H is the number of estimated parameters, k + 1, and the trace of M is n − k − 1, the residual degrees of freedom. For the five households in the stepper the diagonal entries of H are 0.6, 0.3, 0.2, 0.3, 0.6, which add to 2 = k + 1 = 2. A diagonal entry is a household’s leverage: how much its own y pulls its own fitted value. Households far from the mean of x have the highest leverage.
Without an intercept. Drop the column of ones and the normal equation Σe = 0 disappears with it. Regress spending on income alone, through the origin, in the survey: the slope is Σxy ÷ Σx² = 0.7741 and the residuals add to 407.6, not zero. The usual R² is defined with the centred total variation, which no longer splits cleanly, so software reports an uncentred R² of 0.939, compared with 0.606 for the same regression with an intercept. The two cannot be compared, and the uncentred figure can be large even when x and y are barely related. The mean square error is SSE ÷ (n − 1), since only one parameter was estimated.
The classical linear regression model has six assumptions. Each result in econometrics needs some of them and not others, and exam questions are built to see whether you know which.
| Assumption | In words | What it buys, and what goes wrong without it |
|---|---|---|
| 1. Linear in parameters | y = Xβ + u. The model is linear in the coefficients. It need not be linear in the variables: ln y, x² and 1/x are all allowed. | The estimator is a linear function of y. Without it, least squares is not the right method. |
| 2. No perfect collinearity | The columns of X are linearly independent, and n exceeds the number of parameters. X is not all one value. | X′X can be inverted, so there is one unique b. Without it, b does not exist. |
| 3. Zero conditional mean | E(u | X) = 0. The error averages zero whatever the regressors, so it is uncorrelated with them. | Unbiasedness (and consistency). Without it, b is biased: omitted variables, measurement error and simultaneity all break it. |
| 4. Constant variance | Var(u | X) = σ² for every observation: homoscedasticity. | The variance formula σ²(X′X)⁻¹ and the Gauss-Markov result. Without it, b is still unbiased, but its standard errors are wrong and it is not best. |
| 5. No autocorrelation | Cov(uᵢ, uⱼ) = 0 for i ≠ j: the errors are uncorrelated across observations. | Again the variance formula and BLUE. Without it, b is unbiased, but standard errors are wrong and it is not best. |
| 6. Normal errors | u is normally distributed. | Exact t and F distributions in small samples. Not needed for unbiasedness, for the variance, or for BLUE. In large samples the central limit theorem makes the tests approximately right anyway. |
Two traps recur. First, assumption 3 is about the error and the regressors, not about y: Cov(y, u) is not zero. Since y = Xβ + u, the covariance of y with u is the variance of u, which is positive (JAM 2025). Second, “linear” means linear in the parameters. A regression of y on x and x² is a linear regression; one of y on x^β is not (JNU 2021, JAM 2025).
The two properties that everything rests on follow in a few lines from writing the estimator as the truth plus a term in the errors. Open the steps one at a time.
Substitute y = Xβ + u into b = (X′X)⁻¹X′y:
The estimate is the true β plus a term built from the errors. All the sampling variation is in u.
Take the expectation given X. The matrix (X′X)⁻¹X′ is fixed once X is given, so it passes through:
Only E(u | X) = 0 was used, with X′X invertible. Nothing about the errors’ variance. This is why OLS stays unbiased when the errors have unequal variances or are correlated with each other.
The deviation b − β is (X′X)⁻¹X′u. The variance of a matrix times u is the matrix, times Var(u), times the matrix transposed:
The step σ²I is where constant variance and uncorrelated errors are used. If either fails, the formula is wrong, and so are the standard errors built on it.
The variance of one coefficient is σ² times the matching diagonal entry of (X′X)⁻¹. In the survey regression the entry for income is 0.000055. The true error standard deviation is 2.5, so the true standard error of the income coefficient is √(6.25 × 0.000055) = 0.0185. The regression, which does not know σ, estimates it with s = 2.564and reports 0.019. Close, as it should be.
Unbiasedness alone does not make an estimator good: the slope through just the first and last observation is also unbiased, and it is a poor use of the data. The question is which unbiased estimator is least spread out. The Gauss-Markov theorem answers for a whole family:
The proof is short. Write any other linear unbiased estimator as b̃ = [(X′X)⁻¹X′ + D]y for some matrix D. Unbiasedness forces DX = 0. Its variance is then σ²[(X′X)⁻¹ + DD′], and DD′ cannot be negative, so no choice of D can beat D = 0, which is OLS itself. Watch it happen: the lab draws the same data twice over and estimates the slope with least squares and with a rival, 2,000 times.
Both estimators are unbiased: their averages, 1.5 and 1.501, sit on the true 1.5. Neither is wrong on average. But the rival (the gap between the mean y of the upper and lower halves of x, over the gap in mean x) is a more wasteful use of the same data, and its spread is 0.259 against 0.22 for least squares (theory: 0.255 and 0.221). Among all estimators that are linear in y and unbiased, least squares is the one with the smallest spread, and no rival you can invent beats it, whatever n and σ you choose. That is the Gauss-Markov theorem.
The variance of one coefficient is σ² times the matching diagonal entry of (X′X)⁻¹. That entry has a clean form, which follows from the partialling-out result of lesson 1:
Four levers move it: a smaller error variance σ² (a better-fitting model), a larger sample (the sum grows with n), more spread in xj (the sum grows), and a lower correlation of xj with the other regressors (Rj² nearer zero). The last is multicollinearity, the subject of lesson 8. Delhi School 2018 asks which of these raise the variance: smaller sample, less variation in the regressor, more variation in the error, higher correlation between regressors. All four do.
| Regressor | Σ(x − x̄)² | R² on the others | VIF | SE if uncorrelated | SE reported |
|---|---|---|---|---|---|
| Income | 26,183.9 | 0.305 | 1.44 | 0.0158 | 0.019 |
| Household size | 1,474.2 | 0.226 | 1.29 | 0.0668 | 0.0759 |
| Town dummy | 144.8 | 0.337 | 1.51 | 0.2131 | 0.2617 |
Survey regression of spending on all three. The reported standard error is the standard error if the regressor were uncorrelated with the others, multiplied by √VIF. Here the regressors overlap only mildly, so the inflation is small. Lesson 8 shows what happens when it is not.
IIT JAM 2022 printed a question with n = 23 observations, three coefficients, X′Y = (0.3, 0.2, 0.1)′ and e′e = 0.7, and gave (X′X)⁻¹ as
This cannot be the inverse of any X′X. The matrix X′X is symmetric, because its (i, j) entry is the sum of column i times column j, which is the same as column j times column i. The inverse of a symmetric matrix is symmetric. The printed matrix is not: its (1, 2) entry is 0.5 and its (2, 1) entry is 0.4. The data are inconsistent, and no t statistic is defined. The bank’s record of the official key says the question was dropped and every candidate was given the marks.
If you ignored the problem and read the matrix as printed, the third row would give b₃ = 0.4 × 0.3 + 0.5 × 0.2 + 0.3 × 0.1 = 0.25, s² = 0.7 ÷ 20 = 0.035, and t = 0.25 ÷ √(0.035 × 0.3) = 2.44. That is not an accepted answer, and it is not offered in practice. The lesson is the check, which takes five seconds: X′X and its inverse are always symmetric, and a variance matrix has a non-negative diagonal.
Definitions and one-step calculations: a t statistic, an R², which assumption is which. Most CUET and JNU questions sit here.
Restricted against unrestricted regressions, reading output, and statement questions, up to GATE and IIT JAM level.
This topic’s hardest questions, from the DSE entrance, are worked through in Lesson 18: The algebra of least squares.
These are questions from the TestStop bank. A free account answers 10 a day, each with its worked solution; All-Access opens every set with no daily limit.
The Delhi School’s questions on these ideas (the variance of one coefficient, regression through the origin) are collected in the hard-problems lesson at the end of the module. Until it is published, they are not served in practice.