Chapter 3 · Section 8 practice

Test-Set Accuracy and Honest Prediction Scope

Work from question 1 to 10. Edit your Python box, click Run Code, review the result, then click Submit attempt. Reference answers unlock after all ten attempts are submitted. This records completion, not correctness. Each box runs independently. Progress is saved in this browser.

Submitted: 0 / 10

1. Recognise overfitting

Warm-up. A simpler model has training RMSE s=0.4 and validation R²=0.7; a flexible model has training RMSE s=0.2 and validation R²=0.5. Print which model validation R² favours and explain why.

Write your answer, then run it.

2. Predict test rows

Warm-up. Print the first three test predictions.

Write your answer, then run it.

3. Read prediction errors

Warm-up. Print the first three test errors, observed minus predicted.

Write your answer, then run it.

4. Calculate test R-squared

Build your skills. Print test R-squared.

Write your answer, then run it.

5. Read prediction scope

Build your skills. Print why this CAPM test is conditional rather than a standalone forecast before market close.

Write your answer, then run it.

6. Compare training and test fit

Build your skills. Print training and test adjusted R-squared, then training and test RMSE in percentage points, using the course n-k-1 formula. Keep the training model fixed and round to four decimals.

Write your answer, then run it.

7. Check time separation

Build your skills. Print whether the last training date precedes the first test date.

Write your answer, then run it.

8. Check the fitted sample

Challenge. Print model.nobs and the number of training rows.

Write your answer, then run it.

9. Reconstruct RMSE s

Challenge. Calculate fitted CAPM RMSE s using n-2 and compare it with model.mse_resid.

Write your answer, then run it.

10. Interpret negative test R-squared

Challenge. If test R-squared is -0.2, print its interpretation.

Write your answer, then run it.

Reference answers are locked until all 10 attempts are submitted.