Linear Regression (FIT2086)

Context: FIT2086_MOC Β· the first supervised model of the unit β€” point estimation, intervals and testing now applied to a mean that varies with predictors Β· the rigorous version of Linear and Polynomial Regression Β· fit ≑ ML βž” Least Squares as Maximum Likelihood Β· design-matrix tricks βž” Predictor Transformations (Indicators, Polynomials, Interactions) Β· choosing which predictors βž” Model Selection and Information Criteria (AIC, BIC)

Quick Revision

  • 🎯 Objective: let the conditional mean of move linearly with the predictors βž” estimate by least squares βž” predict, and read one coefficient at a time.
  • πŸ“¦ Core Components: simple βž” 2 free parameters | multiple βž” | fit measured by | scale-free fit by .
  • ⚑ Key Constraint: always rises when a predictor is added βž” it can rank fit but can never choose a model; and least squares needs or the solution is non-unique.

πŸ“ How It Works

1. Supervised Learning Setup

  • Data shape βž” variables measured on individuals; predict one variable from the remaining .
  • Target βž” also response / outcome; treated as a random variable because measurement carries error.
  • Predictors βž” also explanatory variables / covariates / exposures; assumed known without error.
  • Task split βž” categorical target ⟹ classification (W7); numerical target ⟹ regression (here).
  • What is learned βž” an with ; β€œsupervised” because labelled examples exist. No fits perfectly.

2. From the Mean Model to a Line

  • Baseline βž” , β€” one prediction for everybody, ignoring all other data.
  • Upgrade βž” β€” the mean is now conditional on the predictor.
  • Strict nesting βž” collapses the line back to the mean model with ⟹ the mean model is a submodel, which is exactly why it serves as the reference.
  • Payoff on the BP data βž” falls by using weight alone.

3. Reading the Parameters

  • Simple form βž” βž” is the intercept ( at ), the regression coefficient (change in per one unit of ).
  • Multiple form βž” βž” is when all ; is the change per unit of with the others held fixed.
  • Worked reading βž” (BP on weight): average BP; at the model says β€” a nonsense extrapolation outside the observed range.
  • Magnitude is not importance βž” depends on the predictor’s units, so it cannot rank predictors βž” standardise or use the -score (Model Selection and Information Criteria (AIC, BIC)).

4. Fitting by Least Squares

  • Residual βž” β€” the model’s error on an observation it was fitted to.
  • Least-squares principle βž” pick the coefficients minimising the squared total error; smaller = better fit.
  • Stationary equations βž” set both partials to zero (chain rule), then solve the resulting linear system:
  • Two free properties of the solution βž” and β€” the fitted line leaves zero mean residual and residuals uncorrelated with the predictor. Structure left in a residual plot is therefore not linear-in- structure βž” it signals a needed transformation.
  • Identifiability βž” requires ; with the minimiser is non-unique. Efficient algorithms solve the multiple-predictor case directly.
  • Alternative losses exist βž” e.g. least absolute errors; squares win on simplicity, computational efficiency, and the normal-model connection.

5. β€” the Scale-Free Fit Score

  • Why not βž” its scale is arbitrary; means nothing without a reference.
  • Reference βž” β€” the of the intercept-only mean model.
  • Definition βž” , the coefficient of determination; = no explanatory power, = data fully explained.
  • Monotone in predictors βž” adding any predictor always increases βž” a predictor that raises it a lot is potentially important, but the ranking cannot be used to stop adding.

6. Predicting New Data

  • Point prediction βž” for new predictor values .
  • Full predictive distribution βž” the normal error model gives βž” probability statements, not just a number (Plug-in Prediction and Held-Out Evaluation).
  • Sensitivity reading βž” sweep one predictor, hold the rest, and watch move β€” this is how a fitted model answers β€œwhat if”.
  • Range discipline βž” predictions outside the observed predictor ranges are unsupported by the data.

πŸ”¬ Model

  • Declared spaces βž” , design matrix (plus an intercept column), , .
  • Mean function βž” ; only the mean is modelled β€” the spread is constant across .
  • Objective (least squares) βž”
  • Noise model βž” independently ⟹ the LS estimates are the ML estimates βž” derivation and the two estimators in Least Squares as Maximum Likelihood.

πŸ“Š Exam Execution Trace & Applied Exercises

Applied Exercise

Problem: On the blood-pressure data the mean model gives . Regressing on weight gives ; adding age gives with . Report both values and predict for a , -year-old.

Final Extracted Output: rises ; predicted . Each extra kilogram adds , each extra year .

⚠️ Common Mistakes

  • πŸ’‘ Using to pick a model βž” it is monotone in the predictor count, so the full model always wins βž” a complexity penalty is required (Model Selection and Information Criteria (AIC, BIC)).
  • πŸ’‘ Comparing raw across predictors βž” scale-dependent; vs says nothing about importance unless the predictors share a scale or are standardised.
  • πŸ’‘ Interpreting the intercept literally βž” is at , which is usually far outside the data (a person).
  • πŸ’‘ Forgetting β€œholding the others fixed” βž” in multiple regression is a partial effect; a coefficient can change sign when other predictors enter.

🧠 Active Recall