Estimation: OLS
The least-squares principle derived from scratch with ordinary calculus, the resulting formulas for the intercept and slope, a full hand-worked numerical example, and R-squared as a measure of fit.
- State the least-squares criterion and derive the normal equations by minimising SSR
- Compute OLS estimates b1 and b2 by hand from a small dataset
- List the key algebraic properties of the OLS fitted line
- Compute and interpret R-squared as a measure of goodness of fit
How the exam asks it: four core exam templates
Midterm exams on OLS estimation test four standard formats: hand-calculating and from small datasets, computing via ANOVA decompositions, estimating parameters from given deviation sums, and interpreting regression output tables.
Exam template 1: Full hand calculation of the OLS line from raw data
Question: Five students report study hours and exam scores : and .
a) Calculate the sample means and .
b) Calculate and , and solve for the slope .
c) Calculate the intercept , write the estimated regression line , and interpret the slope.
Exam template 2: Computing R-squared from residuals and total variation
Question: For the five students in Template 1, the residuals are and .
a) Compute the residual sum of squares .
b) Compute the total sum of squares .
c) Compute and interpret its value.
Exam template 3: Estimating from summary sums
Question: An exam problem provides summary statistics for an empirical dataset: , , , and .
a) Calculate the OLS slope coefficient .
b) Calculate the OLS intercept .
c) State the estimated regression equation and predict when .
Exam template 4: Reading and interpreting an EViews output table
Question: An EViews regression table reports: Constant (), regressor (), , , .
a) Compute the t-statistics for the constant and slope.
b) Calculate the estimated error variance and standard error of regression .
c) Interpret the coefficient of determination .
Cheat-sheet & the 4-step method
The least-squares principle
On the slides: OLS is a regression estimation technique that calculates the ‘s so as to minimise the sum of the squared residuals, where is the gap between the actual and the estimated by the regression.
Infinitely many lines could be drawn through a scatter of points. Ordinary least squares (OLS) picks the one specific line that makes the residuals, as a whole, as small as possible — precisely by minimising the sum of squared residuals.
- sum of squared residuals
- the candidate intercept and slope being chosen
Use it when you need to explain what OLS is actually optimizing, before deriving the formulas for b1 and b2.
Deriving the normal equations
This is exactly the unconstrained optimization technique from the Mathematics I course, applied to a function of two variables and : set each partial derivative to zero.
- the sample means of X and Y
- sum of products of deviations from the means
- sum of squared deviations of X from its mean
Use it when you need to compute the OLS intercept and slope by hand from raw (X,Y) data — the single most-used formula pair in this course.
The slides write the same slope in two equivalent ways, with small letters for deviations from the mean (, ):
- deviations from the means
- sums of the raw values
- sample size
Use it when you are given raw sums (the second form) or a deviation table (the first form); both give the same number.
A full hand-worked example
The lecture’s numerical example
Algebraic properties of the OLS line
These are not assumptions — they are automatic mathematical consequences of the two normal equations derived above (the first normal equation directly implies property 1; combined with property 1, the second implies property 2).
Try it: drag the data, watch OLS refit
R-squared: goodness of fit
- total sum of squares
- explained sum of squares
- residual (unexplained) sum of squares
Use it when you need to break down the total variation in Y into the part the regression line explains and the part it leaves unexplained.
- the proportion of the total variation in Y explained by the regression, 0 \leq R^2 \leq 1
Use it when a question asks how well the fitted line explains the data — the standard, single-number goodness-of-fit measure for a two-variable regression.
Reading EViews output
The lecture tests Keynes’s consumption function on Gujarati’s Table 2.4 data: weekly income and weekly consumption , with . Keynes predicted that consumption rises with income but by less — a marginal propensity to consume between 0 and 1. EViews estimates the line by OLS and prints:
| Variable | Coefficient | Std. Error | t-Statistic | Prob. |
|---|---|---|---|---|
| C | 24.45455 | 6.413817 | 3.812791 | 0.0051 |
| X | 0.509091 | 0.035743 | 14.24317 | 0.0000 |
| Statistic | Value | Statistic | Value |
|---|---|---|---|
| R-squared | 0.962062 | Mean dependent var | 111.0000 |
| Adjusted R-squared | 0.957319 | Sum squared resid | 337.2727 |
| S.E. of regression | 6.493003 | F-statistic | 202.8679 |
Interpreting the slope. : within the sample range of X between 80 and 260 dollars per week, a one-dollar increase in weekly income is associated with an estimated increase of about 51 cents in average weekly consumption expenditure.
Interpreting the intercept. : mechanically, the average weekly consumption when weekly income is zero. Taken literally this is not always meaningful, but it can be argued that a family with no income (unemployment, layoff) maintains some minimum consumption financed by borrowing or dissaving.
Interpreting R². means about 96 percent of the variation in weekly consumption expenditure is explained by income. Since R² can be at most 1, the sample regression line fits the data very well.
Checking the printed numbers.
- Each t-statistic is the coefficient divided by its standard error: (EViews prints 14.24317, the small difference is rounding of the displayed coefficient).
- The S.E. of regression is the square root of the estimated error variance: .
- In a two-variable regression the F-statistic is just the square of the slope’s t: .
Akaike info criterion, Schwarz criterion and Durbin-Watson appear in fuller output; what they mean comes later in the course.
Exam practice
Summary and review
- OLS minimises .
- Setting and gives the two normal equations, solved to get and .
- OLS residuals always sum to zero, and the fitted line always passes through — automatic consequences of the normal equations.
- ; , the proportion of variation in Y explained by X.
- A high R² does not by itself validate a model’s specification or causal story.
- The statistical properties of (standard errors, BLUE) rest on the CLRM assumptions: Lesson 4.
- EViews output pairs each coefficient with its standard error, t-statistic and p-value; in Gujarati’s consumption example (about 51 cents per extra dollar) and .
Step-by-step examples
Work through the ladder one level at a time: at every step, try to say what comes next before you reveal it. Easy builds the basic moves, medium combines the formulas, and the exam level has the shape of a real exam question.