Print this page and work through it on paper. Revealed answers are never printed, so you can check one question and still print a clean sheet.
Statistics · Chapter test
Correlation and Regression
Work this sheet on paper, showing every step — the method is what is being checked, and the solutions are written so you can follow your own route rather than just compare a final number. Name every result you use (“by Gauss–Markov”, “by the decomposition of variation”, “from the normal equations”) and say which of the LINE conditions each inferential step relies on. The arithmetic has been chosen so that no calculator is needed: leave surds as surds and use only the approximations supplied in the questions. Full worked solutions are on a separate page; each question also has its own reveal, so you can check one answer without seeing the rest.
- 1.Computation · 7 min
Four paired observations are recorded: .
- (a)Compute , , and the sample correlation exactly, leaving any surd as a surd. Check your value against the theorem that bounds .
- (b)The values are re-expressed as and the values as . Without recomputing any sum, state the new correlation and justify it by naming the result you are using. Then confirm it by computing , and from the originals.
- (c)Now take the five points with . Compute , and say precisely what this example shows about what the correlation does and does not measure.
Show the solution to question 1
(a) Centre, then sum. and . The deviations are and , so
Hence
Sanity check: , as the theorem Correlation lies between and requires, and it is strictly less than because the points are not collinear — the slope from to is , while from to it is .
(b) Invoke invariance; recompute nothing. By the proposition Correlation is invariant under increasing linear rescaling, if and then . Here and , so and
The shifts and do nothing, because centring removes them; the factor scales and equally and cancels; only the sign of survives.
Confirmation: centring gives and , so , and . Then
(c) A perfect relationship with zero correlation. and . The -deviations are , and since the -deviations are the values themselves:
So exactly, even though is determined by without any noise at all. (For the record and , both positive, so is well defined.)
The lesson: measures linear association only. Every product on the left of is cancelled by its mirror image on the right, because the parabola rises on one side exactly as it falls on the other. A correlation of zero is compatible with a deterministic relationship, which is why a correlation quoted without a scatterplot has not had its meaning checked.
- 2.Computation · 7 min
For the four points you may take , , , , and as given.
- (a)Find the least-squares line , naming the theorem that supplies the formulas, and check that the line passes through the point of means.
- (b)Compute the four fitted values and the four residuals, and verify both identities and numerically.
- (c)Verify the relation for this data, and use it to explain what is meant by “regression to the mean” for a point one standard deviation above .
Show the solution to question 2
(a) The least-squares estimates. By the theorem The least-squares estimates, the minimiser of is
The line is . At it gives , so it passes through — which is exactly what the first normal equation says.
(b) Fitted values and residuals.
so the residuals are
Sum: . Weighted sum: . Both hold by the proposition Two properties of least-squares residuals — they are the two normal equations rewritten, so they hold for every data set, not just this one.
(c) Slope equals correlation in standard units. , since both standard deviations carry the same divisor , which cancels. So
This is the corollary Slope, correlation and the regression effect. Read it in standard units: a point at is predicted at , that is standard deviations above — closer to its mean, in relative terms, than the predictor was to its own. With this close to the pull is slight; with the prediction would sit only half a standard deviation up. Nothing is acting on anything: regression to the mean is what imperfect correlation looks like when you predict.
- 3.Proof · 6 min
Let be the least-squares estimates for data , , with , and let and . Work only from the fact that minimises .
- (a)Prove that and .
- (b)Deduce that .
- (c)Deduce that the sample correlation between the and the is exactly zero whenever the residuals are not all zero, and explain what this means for a plot of residuals against .
Show the solution to question 3
(a) The normal equations. is a differentiable function of and the minimum is attained (it is a positive-definite quadratic when , as the theorem The least-squares estimates shows), so both partial derivatives vanish there:
Dividing by gives and .
(b) Fitted values are a combination of and . Since ,
Geometrically: the residual vector is orthogonal to the column of ones and to the column of 's, hence to everything in their span, and the fitted vector lies in that span.
(c) Residuals are uncorrelated with the predictor. By (a) the mean residual is . Therefore
If the residuals are not all zero then , and by hypothesis, so .
Consequence: a plot of against can never show a linear trend, whatever the data — a least-squares line through that plot would have slope . That is a property of how the line was chosen, not evidence about the data. What the plot can show is anything non-linear: curvature, or a spread that changes with . Those are the two things the fitting procedure did not remove, and they are exactly what the residual plot is used to diagnose.
- 4.Computation · 7 min
The line was fitted to , with residuals , and , , , .
- (a)Compute from the identity , compute directly from the residuals, and verify the decomposition . State why the cross term in that decomposition vanishes.
- (b)Compute and confirm that it equals .
- (c)Compute and exactly, say in one sentence what measures, and explain why does not by itself establish that a straight line is the right model.
Show the solution to question 4
(a) The three sums of squares. By the proposition For simple regression, R-squared is r squared, ; as a check, as well. Directly from the residuals,
With we get .
The cross term vanishes because , so it equals by the proposition Two properties of least-squares residuals — this is the theorem Decomposition of variation in regression.
(b) Coefficient of determination.
The line accounts for of the variation in .
(c) Residual standard error. Two parameters were estimated, so the divisor is :
estimates , the standard deviation of an observation about the true line — roughly, how far a typical point sits from the fitted line in the units of . Against that is a small scatter, consistent with the high .
But is computed from three sums of squares and is blind to the pattern of the residuals. Anscombe's quartet has four data sets with identical , identical fitted line and identical , of which one is curved, one is driven by a single high-leverage point and one contains an outlier. Here the residuals alternate in sign with no trend, which is reassuring — but that reassurance came from looking at the residuals, not from the .
- 5.Sketch · 10 min
An experimenter measures a response at and records . (The response is in fact exactly, but the experimenter does not know this and fits a straight line.)
- (a)Fit the least-squares line.
- (b)Compute the five fitted values and residuals, then , and as an exact fraction.
- (c)Sketch the scatterplot with the fitted line drawn on it, and beneath it the plot of residuals against fitted values. Every feature you draw must be labelled with a number from (a) or (b). Name the LINE condition the second plot shows to be violated, and explain why the of (b) failed to reveal it.
Show the solution to question 5
(a) Fit the line. and . Deviations: and . Then
so and . The fitted line is .
(b) Residuals and the sums of squares. Fitted values at are , so the residuals are
Check: and .
and , with . Hence
(c) The two pictures. Scatterplot. Mark the five points ; they rise ever more steeply. Draw the line through and ; it passes through the point of means . The line lies below the data at both ends — at the point is above it, at it is above — and above the data in the middle, by at . The line crosses the curve where , that is at and ; mark those two crossings.
Residual plot. Horizontal axis: fitted value, from to ; vertical axis: residual, from to , with a dashed line at . Plot . The points trace a clear U: positive at both ends, negative in the middle, symmetric about the centre. This is not a random band about zero.
Which condition fails. Linearity. is , not , so the line is systematically too low at the ends and too high in the middle, and the residuals inherit that curvature. (Independence, normality and equal variance are not what this plot indicts — there is no noise at all.)
Why did not see it. depends on the residuals only through the single number . Reorder the same five residuals to and is unchanged, though the U has vanished. A fit accounting for of the variation sounds excellent, and the line is a decent summary of the trend — but the model is wrong in a way that would ruin every prediction at the ends, and only the residual plot says so. That is the pitfall of Anscombe's quartet made concrete.
- 6.Proof · 9 min
Assume with the errors independent, and for every . Normality is not assumed. Write .
- (a)Show that , and prove the three identities , and .
- (b)Deduce that and , stating at each step which assumption is being used.
- (c)Four observations are to be taken on the interval . Design A uses ; design B uses . Compute under each, say which is more precise and by what factor, and explain what design B is incapable of detecting.
Show the solution to question 6
(a) The slope is linear in the responses. Since , the constant drops out of the covariance sum:
so . For the identities:
(b) Mean and variance. Linearity of the model and give , so by linearity of expectation
For the variance, independence kills every cross term, so the variance of the sum is the sum of the variances: . Equal variance makes every , hence
Normality was never used — this is the unbiasedness and variance part of the theorem Gauss–Markov, and the corollary Precision of the slope. Normality enters only when the distribution is needed for intervals.
(c) Two designs. Under A, with deviations , so and . Under B, with every deviation , so and .
Design B is more precise, by the factor : pushing the 's to the ends of the interval maximises , which is the denominator in the variance. This is the remark How to make a slope precise — with a trusted linear model, half the points at each extreme is optimal.
What B cannot do is check linearity. With only two distinct values there are only two group means, and a line has two parameters, so the least-squares line passes exactly through both means. Every residual is then a within-group deviation; the residual-versus-fitted plot has two vertical stacks and no capacity to bend. Had the true relationship been curved between and , design B would report a perfect straight line and could never know otherwise. Design A gives up some precision to buy the ability to see the U of the previous question.
- 7.Computation · 10 min
For the four points : , , , , , , . Assume the full LINE conditions. You may use , and .
- (a)Compute the standard error of exactly, and test against at . State the sampling distribution you are using and its degrees of freedom.
- (b)Give a confidence interval for .
- (c)At give a confidence interval for the mean response and a prediction interval for a single new observation. Express both standard errors exactly, identify the term responsible for the difference, and state the exact ratio of the two half-widths.
- (d)Compute and verify that it equals from (a).
Show the solution to question 7
(a) Standard error and test. By the corollary Precision of the slope,
By the theorem Sampling distribution of the slope, under the statistic follows . Here
Since , reject : the predictor carries linear information about the response, even with only two degrees of freedom to spare.
(b) Interval for the slope. , so the interval is approximately . It excludes , in agreement with (a), and it is wide: two degrees of freedom make more than twice the familiar .
(c) Two intervals at the centre. , and , so by the theorem Confidence and prediction intervals:
Mean response. . Margin ; interval .
New observation. . Margin ; interval .
The difference is the extra under the root: , the being the new observation's own noise , independent of everything used to fit. The ratio of half-widths is
and it would be even larger for bigger , since the numerator has a floor at while the denominator tends to .
(d) The check. and , so . From (a), . The two tests are the same test: the model comparison between the fitted line and the intercept-only model, with .
- 8.Critique · 8 min
A student fits to the four points , obtaining , , , , and writes the following report.
Step 1. Since , the line explains of the variation, so the relationship is certainly real and no test of the slope is required.
Step 2. A interval for the value of that will be observed next time is .
Step 3. The interval in Step 2 shrinks to zero width as , so with enough data the next observation at could be predicted exactly.
Step 4. Because the fitted line passes through , the interval in Step 2 has the same width at every .
You may use , , and .
- (a)Identify every flaw. For each, say which theorem, term or distinction is being misused. (One step is correct; say which.)
- (b)Give the correct interval for the next observation at , and the correct interval for the mean response at .
Show the solution to question 8
(a) Four steps, three flaws.
Step 1 confuses with a test. is a descriptive ratio of sums of squares; it has no sampling distribution attached and says nothing about whether is compatible with the data. The theorem Sampling distribution of the slope is what settles that, and it needs : on tiny data a large can coexist with an insignificant slope. As it happens the test here gives against and the slope is significant — but that conclusion comes from the test, not from the . The number is right; the reasoning is not.
Step 2 uses the wrong interval. The formula is the standard error of as an estimate of the mean response . A single new observation has its own error , and by the theorem Confidence and prediction intervals the variance of is — the is missing. The interval quoted is a confidence interval for the mean masquerading as a prediction interval, and it is far too narrow.
Step 3 is wrong for the interval it claims to be about. The mean-response interval does shrink to zero width, because . The prediction interval does not: its half-width tends to , the floor set by the noise in the observation being predicted, which no amount of data about other observations can reduce. A future observation can never be predicted exactly by a model with .
Step 4 is correct in premise and wrong in conclusion. The line does pass through the point of means — but that is exactly why the width varies: the line pivots about , so slope error has no effect at and a growing effect away from it. The term is zero at and positive everywhere else; both bands are narrowest at and flare outward.
(b) The correct intervals.
New observation at . and
so the interval is , that is — more than twice as wide as the student's.
Mean response at . , and , so
giving , that is . Compare the half-width at the centre: moving three units from has widened the mean-response interval by the factor , which is Step 4 refuted numerically.
- 9.Computation · 9 min
Write the simple regression of on for the four points in matrix form, with having a column of ones and a column of values, so that .
- (a)Write out and , invert the first, and solve the normal equations. Confirm the scalar answer , , and check that the determinant equals .
- (b)Read , and off , and check the first two against and .
- (c)The -th diagonal entry of the hat matrix is where is the -th row of . Compute all four , verify that they sum to , and then prove that for every design matrix of full column rank. You may use .
Show the solution to question 9
(a) The normal equations by hand. With , , and ,
The determinant is , and . (It is in general, the computational formula for the variance.) So
and by the theorem The normal equations and the least-squares solution,
(b) The covariance matrix. By the theorem Mean and variance of the coefficient estimates, , so
and the check: . (This is the mean-response variance at , since .) The off-diagonal entry gives , which is : with a positive , overestimating the slope forces the intercept down, because the line must still pass through the point of means.
(c) Leverages and their sum. For row ,
which is the familiar bracket from the confidence-interval formula. Evaluating: at and , ; at and , . Sum: . The end points carry more leverage — the line is more strongly pulled by them.
Proof that . Using the cyclic property with and ,
Geometrically, by the theorem Least squares is orthogonal projection, projects onto a -dimensional subspace, and the trace of a projection is the dimension of its range. The total leverage is fixed by the model; the data decide only how it is shared out.
- 10.Proof · 10 min
Two predictors and the response have all been centred, so and the intercept may be dropped: the design matrix has just the two columns . Write , , (all with ) and . Assume .
- (a)Write out and prove that it is invertible if and only if . Relate this to full column rank.
- (b)Compute and prove that .
- (c)Regress on alone (through the origin, since both are centred). Compute the residual sum of squares of that auxiliary fit and show . Conclude that and that (b) is exactly the variance-inflation formula in this case.
- (d)If , by what factor is the standard error of larger than it would be with an uncorrelated second predictor, and how many times as many observations would compensate? Say what happens to and to the bias of as .
Show the solution to question 10
(a) The Gram matrix and its determinant.
with determinant , using . Since , the determinant is non-zero exactly when . By Cauchy–Schwarz, , so always; hence invertible .
The equality case of Cauchy–Schwarz is proportionality, , which is precisely failure of full column rank. So this is the theorem The normal equations and the least-squares solution in two dimensions: means the two columns carry the same information and there is no unique fit.
(b) Invert and read off the variance. For a matrix,
By the theorem Mean and variance of the coefficient estimates, , so
With this is , the simple-regression variance; every non-zero inflates it.
(c) The auxiliary regression. Regressing on through the origin minimises , a quadratic in with minimum at . Substituting,
Because is centred its total sum of squares is , so
and . Then (b) reads
which is the theorem Variance inflation with predictors, proved rather than quoted. Note also that is the squared length of the part of not explained by , and : the coefficient is estimated from the leftover part alone.
(d) Numbers, and the limit. With , . Standard errors scale as , so is times what it would be with an uncorrelated predictor. Variance falls as at fixed spread, so compensating would take times as many observations.
As the variance of tends to infinity: the two coefficients become individually meaningless, typically large and of opposite sign. But two things do not break. throughout, by the same theorem — inflation is variance, never bias. And the fitted values depend only on the column space of , which is the same plane for every ; so prediction within the range of the data is unaffected. The data know what the pair predicts; they cannot say which predictor deserves the credit.
- 11.Critique · 9 min
A model with an intercept and two predictors is fitted to observations, giving and . The two coefficients have statistics and , and each predictor has when regressed on the other. Refitting with alone gives and a statistic of for . Critical values: , , .
The analyst reports:
Step 1. , so the model accounts for of the variation.
Step 2. Neither exceeds , so neither predictor is associated with ; the must be an artefact.
Step 3. The variance inflation factors are , which means each coefficient estimate is biased by a factor of about and cannot be trusted in any case.
Step 4. Refitting with alone gives , so the effect of is now established at and was rightly discarded; since rose only from to , the one-predictor model also has the higher adjusted .
- (a)Compute the overall statistic for the two-predictor model, the nested for dropping , and the adjusted of both models, all exactly.
- (b)Identify every flaw in Steps 2–4, naming the theorem, remark or pitfall each one violates, and state what the report should have concluded instead.
Show the solution to question 11
(a) The numbers the analyst did not compute.
Overall . The reduced model is intercept-only, with and ; the full model has , so . By the theorem Nested model comparison,
against . Overwhelmingly significant: the pair of predictors explains far more than chance would.
Nested for dropping . , and indeed , as requires. (Likewise for the refit, . )
Adjusted . With :
The two are equal — in both models. This is the proposition Adjusted R-squared penalises useless predictors sitting exactly on its boundary: adding a predictor raises if and only if , and is the break-even case.
(b) The flaws.
Step 2: insignificant 's do not mean irrelevant predictors. With the predictors are nearly interchangeable, and by the theorem Variance inflation each standard error is times what it would be for an uncorrelated predictor. The data cannot apportion credit between and , so each coefficient, holding the other fixed, is poorly determined. The joint test in (a) says the pair carries a great deal of information, . This is the puzzle in the remark What multicollinearity does and does not break: a highly significant with no significant coefficient is the signature of collinearity, not of an artefact. The is real.
Step 3: inflation is variance, not bias. The theorem Mean and variance of the coefficient estimates gives whatever the correlation among predictors; Gauss–Markov unbiasedness is untouched. What a VIF of says is — the estimate is right on average and imprecise, which is the opposite of “cannot be trusted”. Nor is the factor applied to the estimate: it multiplies the variance, and the standard error by .
Step 4 contains three errors. First, the -value from the refit is not valid: the model was chosen by looking at these same data, and a coefficient that survived a selection step is biased away from zero because it survived — the pitfall on stepwise selection. Since and are near-duplicates, dropping instead would have produced an equally impressive for ; the choice was arbitrary and the “” describes the selection, not . Second, the adjusted claim is simply false — (a) shows the two values are equal, so the criterion is indifferent between the models. Third, “the effect of ” is causal language for what is a partial association; nothing in the fit licenses it (the pitfall on coefficients and causes).
What should have been concluded. The two predictors jointly predict well (, ) and the data cannot say which of them matters. If the goal is prediction inside the observed range, keep both — the fitted values are unaffected by collinearity. If the goal is interpretation, either combine the two into one index, or collect data in which they vary separately, and report any selection that was done as exploratory, with standard errors assessed on data not used to select.
- 12.Computation · 9 min
For the four points : , , , , , , , and the regression of on is . You may use and .
- (a)Fit the regression of on . Show that it is not the algebraic inverse of , and prove in general that the product of the two slopes is . When do the two lines coincide?
- (b)Compute the standard error of the estimated mean response at and at , exactly, and their ratio. Then explain why even the wider interval at understates the real uncertainty there.
- (c)Someone reads the slope as “increasing by one unit will increase by ”. Name three distinct mechanisms that could produce this slope without that being true, and say which of them a residual plot can detect.
Show the solution to question 12
(a) The other regression. Minimising horizontal rather than vertical squared distances, the roles of and swap:
so . Solving for instead gives , with slope . The two are different lines; each is optimal for its own direction of error and neither can be obtained from the other.
Proof of the product. . Here . The inverse of the first line has slope , and the second line has slope ; they agree exactly when , that is when the points are collinear (the theorem Correlation lies between and ). Otherwise the -on- line is always the flatter of the two when drawn in the plane — regression to the mean in both directions at once.
(b) The cost of leaving the data. By the theorem Confidence and prediction intervals, with .
At : .
At : , so and
Ratio: . Twelve units beyond the last observation, the interval for the mean is nearly seven times as wide as at the centre, because the fitted line pivots about and slope error is amplified by the lever arm .
Even so it understates the uncertainty, because the formula is derived assuming the model holds at : that is still out there. The four observations, all in , contain no information about that. A relationship linear over may bend, saturate or reverse beyond it — the parabola of an earlier question fits a line with and then departs from it without limit — and no interval built from and can price a failure of the model's form. The widening is the part of the risk the mathematics can see; the rest is invisible to it.
(c) Why a coefficient is not an effect. The slope describes the conditional mean of given in these data. Three mechanisms produce such a slope with no causal path from to :
Confounding — a third variable drives both and , so they move together without either moving the other.
Reverse causation — drives . The algebra is symmetric: (a) shows the regression of on describes the same four points equally well, and nothing in the fit says which way any influence runs.
Selection — the four points were included because of their values of both variables, creating an association among those observed that need not exist in the population.
A residual plot can detect none of them. It checks the LINE conditions — curvature, changing spread, gross non-normality — which concern how well a line describes the conditional mean. All three mechanisms are perfectly compatible with a clean linear conditional mean and an immaculate residual plot. What licenses a causal reading is the design of the study, not the diagnostics of the fit.
Solutions: calc-path.com/statistics/test/regression/answers