Practice: Shrinkage, and the Trade It Makes
Question
Direct application
For a centred two-predictor design,
Solve the ridge normal equations
Report
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
Hint 2: Next step
By Cramer's rule,
Direct application
On the design of this unit, ordinary least squares gives coefficients summing to
By how much has the penalty reduced the fitted total effect? Report the difference between the two sums, to six decimal places.
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
Add the two ridge coefficients first.
Hint 2: Concept cue
Shrinkage pulls coefficients toward zero, so the penalised total should be the smaller of the two.
Direct application
On the design of this unit at penalty strength
- ridge returns
; - the lasso returns
.
How many predictors does the lasso solution retain, that is, how many of its coefficients are nonzero?
Enter the value. It is checked against the answer and the precision this task asks for.
1 hint available, least help first.
Hint 1: Retrieval cue
A coefficient of exactly zero removes that predictor from the model.
Direct application
A two-predictor design gives
Compute its determinant, exactly.
(Compare your answer with the diagonal entries: that comparison, rather than the number alone, is what indicates near-collinearity.)
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
For
Hint 2: Next step
Both products are close to
Error diagnosis · Explanation
An analyst fits a two-predictor least-squares model and obtains
The analyst concludes there is an arithmetic error somewhere and recomputes, getting the same answer.
(a) Compute the determinant of
(b) Explain why the negative coefficient is not an arithmetic error and not evidence that
(c) The coefficients sum to
Write your answer, then compare it with the worked solution.
2 hints available, least help first.
Hint 1: Retrieval cue
Solving the normal equations means inverting
Hint 2: Concept cue
If
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) The determinant and the correlation.
The correlation between the columns is
A determinant of
A complete answer does each of these:
- diagnoses collinearity
Direct application · Interpretation
On this unit's design, one response value is increased by
| before | after | |
|---|---|---|
| least squares | ||
| ridge, |
(a) Compute the Euclidean displacement of the coefficient vector in each case, and their ratio.
(b) State what quantity this comparison estimates, and why a single fit cannot reveal it.
(c) A colleague says the comparison shows ridge is more accurate. Correct that, saying what the comparison does and does not show.
Write your answer, then compare it with the worked solution.
2 hints available, least help first.
Hint 1: Retrieval cue
The displacement is the Euclidean distance between the before and after coefficient pairs.
Hint 2: Concept cue
Ask what was held fixed in this experiment and what was varied, that determines which property is being measured.
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) The displacements.
Least squares:
Ridge:
Ratio:
The unpenalised coefficients move almost ten times as far in response to the same change in one observation.
(b) What it estimates.
It estimates variance, how much the fitted coefficients depend on the particular sample rather than on the underlying relationship. A different draw from the same process would give somewhat different responses, and this comparison shows how much the answer would move in consequence.
A single fit cannot reveal it because a single fit produces one number per coefficient, with nothing to compare against.
(c) Correcting the accuracy claim.
The comparison says nothing about accuracy. Both fits were computed from the same data and compared with each other, not with any true value.
On accuracy the evidence points the other way. The unpenalised fit minimises squared error on this data by construction, so ridge is strictly worse there. And the ridge coefficients sum to
What the comparison shows is stability: the penalised estimate depends far less on which particular observations were collected. The summary is a trade: variance down by a factor of about ten, bias up, training fit worse, and whether it was worth making is not decidable from these figures, since every one of them comes from the same five observations. That question needs error measured on data the fit has not seen.
A complete answer does each of these:
- quantifies stability gain
Error diagnosis · Method selection
An analyst writes: "We fitted ridge at
(a) Say which
(b) Name the two distinct errors in the quoted procedure.
(c) Describe a procedure that would answer both questions the analyst was trying to answer, which
Write your answer, then compare it with the worked solution.
2 hints available, least help first.
Hint 1: Retrieval cue
What is ordinary least squares defined to minimise?
Hint 2: Concept cue
Two things are being asked of one dataset here. A choice and a measurement. Can the same observations supply both?
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) It will select
2. On the remainder, use
3. Choose the
4. Refit at the chosen
5. Report performance on the test set, which took no part in fitting or selection. The structure matters: step 2 chooses, step 5 measures, and they use different data because a dataset used to choose a parameter can no longer give an unbiased estimate of the result. One caveat worth adding. Cross-validation estimates the performance of the procedure, and the selected
A complete answer does each of these:
- selects penalty honestly
Interpretation · Comparison
Two sensors measure the same physical quantity on the same units, correlating at
| sum | |||
|---|---|---|---|
| least squares | |||
| ridge, | |||
| lasso, |
(a) For each model, say what it asserts about the two sensors, and whether that assertion is credible given what the sensors measure.
(b) The lasso's total is closest to the true effect of about
(c) The team wants to report "the effect of the measured quantity" as a single number with an interpretation. Say what you would report and what you would say about it.
Write your answer, then compare it with the worked solution.
2 hints available, least help first.
Hint 1: Retrieval cue
Compare the three sums with each other, then compare the three values of
Hint 2: Concept cue
Which quantity is stable across the three fits? That is the one the data determines.
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) What each model asserts. Least squares asserts that sensor 1 has a strong positive effect of
A complete answer does each of these:
- contrasts penalty geometry
- diagnoses collinearity
Transfer · Evaluation · Explanation
A lender builds a default-risk model on
Their report states: "Ordinary least squares fitted the training data perfectly, with zero residual error. We then applied a lasso penalty, selecting
Write a review covering:
(a) What a zero training error on
(b) What their
(c) Whether the
(d) Whether the coefficients can be interpreted as effects on default risk.
(e) What you would do instead, including how you would choose between the two penalties and what you would report.
Write your answer, then compare it with the worked solution.
3 hints available, least help first.
Hint 1: Retrieval cue
With
Hint 2: Concept cue
Separate three claims in their report: the fit, the selection, and the interpretation. Each fails for a different reason.
Hint 3: Strategy cue
For (e), decide what the deliverable is, a prediction rule or a statement about factors, before choosing a penalty.
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) Zero training error is the warning, not the result. With
A complete answer does each of these:
- diagnoses collinearity
- computes penalized solution
- contrasts penalty geometry
- quantifies stability gain
- selects penalty honestly
Session complete
Every question in this set has been through once. What you can do now depends on how it went — practising again is worth more than moving on if any of it was uncertain.
Practice data
Your practice record is stored in this browser only. Clearing it removes every answer and every scheduled review, and cannot be undone.