The Linear Model
Everything up to here estimates a single unknown parameter from a sample of one measured quantity. The linear model estimates a relationship: how one measured quantity moves with another.
The data are now bivariate, pairs . Each observation carries two numbers, and the question is what connects them.
1. Reading a scatter plot
Plot the pairs with horizontal and vertical. Three features are worth naming, because they are what the model has to capture or fail to.
- Shape. Linear, exponential, U-shaped, or no discernible form. A linear model is only defensible when the shape is linear.
- Direction. Positive (y rises with x), negative, or none.
- Strength. How tightly the points cluster around the trend. Strong, weak, or absent.
A scatter plot of Gentoo penguin bill depth against bill length shows a positive, roughly linear, moderately strong relationship. That reading is what licenses the model below.
2. Deterministic against statistical
A deterministic model says , and for a straight line
Give it an and it returns one , exactly. That is a claim no real data satisfies: two penguins with the same bill length have different bill depths.
The statistical model keeps the line and adds a term for everything the line does not explain:
What changes is what maps to. In the deterministic model determines . In the statistical model determines , the expected value of the response, and the realized scatters around it. That shift, from a value to an expectation, is the entire content of adding the error term.
3. The simple linear regression model
Definition. Consider bivariate data . A simple linear regression model assumes that are nonrandom and that are realizations of random variables such that for , where are independent random variables with and .
The vocabulary, and each term has a standard alternative that appears interchangeably:
- The -variable is the explanatory variable or independent variable.
- The -variable is the response variable or dependent variable.
- The line is the regression line, with the intercept and the slope.
Four assumptions are doing work here, and an exam question asking you to state the model wants them named.
- The are nonrandom. Only the response is modelled as random. The explanatory variable is treated as fixed and known.
- The errors have mean zero. . Without this the line is systematically offset and absorbs the difference.
- The errors have constant variance. , the same for every . The scatter around the line does not widen or narrow along .
- The errors are independent. One observation’s deviation from the line says nothing about the next one’s.
4. Why the response variables are not identically distributed
This is the point most worth understanding, and it is the one place the linear model breaks the pattern every earlier page established.
Every model so far assumed a random sample: independent and identically distributed. Here that second half fails.
are independent, because they are independent errors added to constants.
are not identically distributed, and the one-line proof is the means:
whenever . Different explanatory values produce different expected responses, which is the whole reason to fit a line. A model in which the were identically distributed would be a model in which carried no information.
They do share a variance: for every , since is a constant. So the responses have a common spread and different centres.
The consequence for the rest of the course: results proved for a random sample do not transfer here without checking. The law of large numbers and the central limit theorem as stated on Estimators and Sampling Distributions assume identical distribution.
5. The regression line is a conditional mean
Taking expectations of the model equation, and using :
The first two terms come out unchanged because is nonrandom, so is a constant.
So the fitted line does not predict an observation, it predicts an average. A point on the regression line is the expected response at that , not the response you would see. Individual observations scatter around it with variance .
Worked example: orange trees
The Orange data set holds 35 measurements of tree circumference in millimetres and tree age in days. Modelling circumference against age :
with the circumference and the age of the th measurement. Here , circumference is the dependent variable, age the independent one.
The fitted line is . What is the expected circumference of a tree 300 days old?
In R this is 17.4 + 0.107 * 300, returning 49.5.
Say expected circumference rather than circumference. A particular 300-day-old tree will not measure 49.5 mm; the model claims that is the average over trees of that age.
6. Fitting the line in R
Orange |>
ggplot(aes(x = age, y = circumference)) +
theme_classic() +
geom_point() +
geom_smooth(method = "lm", se = FALSE, colour = "maroon")geom_point() draws the scatter. geom_smooth(method = "lm") fits and draws the least-squares line, with lm standing for linear model. se = FALSE suppresses the confidence band around the fit, which is the confidence interval machinery applied to the line rather than to a single parameter.
7. Misspecification
A model fitted over one range of is defensible over that range and nowhere else.
Annual global surface temperature from 1970 to 2022, expressed as change from 1950, fits a straight line well:
with the year and the recorded average temperature.
Extend that line back to 1880 and it fails completely. The actual series is roughly flat and then rising; the straight line extrapolated backwards diverges from it badly.
Two conclusions, both examinable as short-answer reasoning.
The fit describes the window it was fitted to. The line may describe the rate of change across those five decades and says nothing about the century before.
A fitted relationship is not a causal one. Year does not explain temperature. Other factors drive the change and happen to be correlated with time over the observed window. Misspecified models lead to misleading results.
Vocabulary to deploy
- Bivariate data: paired observations .
- Explanatory or independent variable ; response or dependent variable .
- Regression line ; intercept ; slope .
- Simple linear regression model , with nonrandom, , , and the independent.
- Independent but not identically distributed: the share a variance and differ in mean.
- Deterministic model against statistical model .
- Misspecification, and the distinction between a fitted relationship and a causal one.