Chapter 3 · Section 7 practice

Multiple Linear Regression and Multicollinearity

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. Read coefficients

Warm-up. Print all three coefficients rounded to three decimals.

Write your answer, then run it.

2. Read model degrees of freedom

Warm-up. Print residual degrees of freedom.

Write your answer, then run it.

3. Predict a complete scenario

Warm-up. Predict Revenue for Ads=4 and Price=8.

Write your answer, then run it.

4. Hold price fixed

Build your skills. Predict Ads=3 and Ads=4 at Price=8, and print the difference.

Write your answer, then run it.

5. Reconstruct adjusted R-squared

Build your skills. Use n=8 and k=2 excluding the intercept to reconstruct adjusted R-squared; compare with statsmodels.

Write your answer, then run it.

6. Inspect predictor correlation

Build your skills. Print the Ads–Price correlation.

Write your answer, then run it.

7. Calculate a predictor VIF

Build your skills. Regress Ads on Price with an intercept; reconstruct Ads VIF.

Write your answer, then run it.

8. Interpret the overall and individual tests

Challenge. State the overall F-test hypotheses for Ads and Price; print its p-value and the individual Ads p-value, then print the decisions at 5%.

Write your answer, then run it.

9. Compare nested fit and errors

Challenge. Fit Ads-only on the same rows. Print R-squared, adjusted R-squared and RMSE s for each model, using n-2 for SLR and n-3 for this MLR. Explain why training improvement alone is insufficient.

Write your answer, then run it.

10. Recognise exact dependence

Challenge. Create AdsTwice=2*Ads, print Ads and AdsTwice, and explain why keeping both prevents separate slope estimation.

Write your answer, then run it.

Reference answers are locked until all 10 attempts are submitted.