/knowledge/statistical-modelling
Statistical Modelling
Linear regression is one model. This is the framework that contains it — and stretches it to counts, yes/no outcomes, and rates, all from one elegant idea.
- Studied
- Statistical ModellingMaster of Data Science
- When
- UniMelb, 2023–2024
- Applied in
- Modelling non-normal outcomes
- Read / Refreshed
- ~16 min read2026-06-25
The linear regression page built one powerful model — but it assumes the outcome is a continuous number with normally distributed error. Real outcomes break that constantly: a yes/no decision, a count of events, a rate. Statistical modelling is the framework that keeps the interpretable, linear core of regression while extending it to all of those — a single, unifying idea called the generalised linear model.
This is the statistician's answer to "model anything", and it's the deliberate counterpoint to the machine learning view: where ML optimises for prediction, statistical modelling prizes understanding — coefficients you can interpret and inferences you can defend. Here's how one elegant structure covers an enormous range of data.
01
Beyond the straight line
Ordinary linear regression makes two assumptions that often don't hold: that the outcome can be any real number, and that its error is normal with constant variance. Try to use it where they fail and it misbehaves — predict a probability and it cheerfully returns 1.4 or −0.3; model a count and it can predict negative events.
The fix isn't a different model for every case — it's one framework that bends to fit. The insight of the GLM is to keep the familiar linear combination of predictors at the core, but connect it to the outcome through two flexible pieces: a choice of distribution for the outcome, and a link that translates between the linear predictor and that distribution's scale.
02
The generalised linear model
A GLM is built from three components, and once you see them you can construct a model for almost any outcome:
- Random component — the probability distribution of the outcome (Normal for continuous, Binomial for yes/no, Poisson for counts). This is your choice about what kind of data you have.
- Systematic component — the familiar linear predictor , a weighted sum of the features. Unchanged from linear regression.
- Link function — a function connecting the mean of the outcome to the linear predictor.
The link g connects the outcome's mean to the linear predictor η = Xβ. Pick the distribution and the link, and you have a model.
The link is the clever part. Instead of modelling the mean directly (which might be bounded, like a probability in ), you model a transformed mean that can range freely over all real numbers — so the linear predictor is never forced to produce an impossible value. Choose the distribution and the link to match your outcome, and the same machinery fits it. Ordinary linear regression is just the special case: Normal distribution, identity link .
03
Logistic regression
The most-used GLM models a binary outcome — yes/no, click/no-click, default/repay. The outcome is Binomial, and the natural link is the logit (the log-odds), which stretches a probability in out onto the whole real line:
Run it backwards (the inverse link is the S-shaped logistic function) and any linear predictor maps to a valid probability between 0 and 1 — no more impossible predictions. The coefficients have a clean reading too: each is the change in log-odds per unit of , and is an odds ratio — "this factor multiplies the odds by 1.5". It's the workhorse classifier of statistics, and the bridge to the classification models on the ML page.
04
Poisson regression
For count outcomes — number of support tickets, accidents per intersection, visits per patient — the outcome is Poisson and the link is the log:
Modelling the log of the expected count keeps predictions positive (a count can never be negative) and makes the coefficients multiplicative: is the factor by which the rate multiplies per unit of the predictor. Same three-part recipe, different distribution and link — and that's the whole point of the framework. (When counts are more variable than Poisson allows — overdispersion — you reach for the negative-binomial cousin, but the structure is identical.)
05
Fitting and likelihood
You can't fit a GLM with the tidy closed-form formula that ordinary least squares enjoys. Instead you use maximum likelihood — the same principle from the statistics page: choose the coefficients that make the observed data most probable under the model. There's no algebraic solution, so it's found numerically by an iterative routine (iteratively reweighted least squares), but conceptually it's simple — turn the dial on until the data looks as likely as possible.
The payoff of the likelihood approach is that it comes with a full inferential toolkit for free: standard errors, confidence intervals, and tests for each coefficient, exactly as on the regression page — so a fitted GLM tells you not just the effect sizes but how sure you can be of them.
06
Model selection
With a framework this flexible, the danger is building a model that's too complex — fitting the noise, the overfitting problem again. You need a principled way to compare models that rewards fit but penalises complexity. The standard tool is the Akaike Information Criterion:
Here measures how well the model fits (the maximised log-likelihood) and is the number of parameters — so AIC trades goodness-of-fit against complexity, and lower is better. Adding a useless predictor improves fit a little but costs in the penalty, so AIC only keeps it if it earns its place. The close relative BIC penalises parameters more harshly (it scales the penalty by sample size), favouring simpler models. Both are formal expressions of Occam's razor — the same parsimony instinct as regularisation, in a different guise.
07
Diagnostics and fit
A fitted GLM still needs checking. The analogue of the residual sum of squares is the deviance — a measure, built from the likelihood, of how far the model's fit falls short of a perfect one; lower deviance is better fit, and comparing deviances formally tests whether an added term helps. As on the regression page, you also inspect residuals (specially defined for GLMs) for leftover patterns the model missed, and watch for influential points distorting the fit. The discipline is the same: the model isn't done until you've looked at what it got wrong.
08
When data has structure
GLMs assume observations are independent — but often they're not. Repeated measurements on the same patient, students within the same school, readings from the same sensor: these are grouped, and ignoring that structure understates your uncertainty. Mixed-effects (or hierarchical) models extend the framework with random effects — group-level terms that let each cluster have its own adjustment while still sharing overall structure. It's how you honestly model nested, correlated data, and it connects directly to the Bayesian hierarchical view. The unifying message: pick the distribution, link, and grouping that match how the data was actually generated.
09
Where it shows up in my work
10