β Conditional distributions in the GLM Β· β GLM in 3D Β· β GLMM interactive
Look at the nature of the outcome variable β range, discrete/continuous, symmetric/skewed:
- Bernoulli β binary outcomes: diagnoses, success/failure.
- Poisson β count data (0, 1, 2, β¦). Note: with overdispersion β Negative Binomial.
- Gamma β positive, right-skewed: reaction times, waiting times, costs.
- Normal/LM β continuous, symmetric, no hard zero boundary: z-standardised questionnaire scores, IQ.
Check fit via Posterior Predictive Check Β· AIC/BIC for comparing alternative families.
Go through it systematically: The Likelihood Compass walks through all distribution families β with required parameters, priors, and brms syntax for each.
The problem: The linear predictor Ξ· = a + bΒ·x can take any value (ββ to +β). But many outcome variables have a restricted range: probabilities lie in (0,1), count rates must be positive.
The solution: A link function transforms the expected value into a range where linear modelling makes sense:
- Logit link (Bernoulli):
log(p/(1-p)) = Ξ·β maps p β (0,1) to (ββ,+β); inversely, every Ξ· gives a p = 1/(1+e^(βΞ·)) β (0,1). The S-curve in the plot. - Log link (Poisson, Gamma):
log(Ξ») = Ξ·β maps Ξ» > 0 to (ββ,+β); inversely, Ξ» = e^Ξ· is always positive. The exponential curve in the plot. - Identity link (Normal):
E[y] = Ξ·β no transformation; the LM is a GLM special case with normal distribution and identity link.
The LM minimises RSS β which is equivalent to maximum-likelihood estimation under a normal distribution assumption. When this assumption is violated, the estimates can still be computed, but:
- Predictions fall outside the valid range (p < 0 or p > 1)
- The log-likelihood is suboptimal β AIC/BIC worse
- Residuals are systematically non-normal
- Inference (confidence intervals, tests) is biased
AIC penalises poor fit and number of parameters: AIC = β2βΜ + 2k
Rule of thumb for ΞAIC = AIC(LM) β AIC(GLM):
- ΞAIC < 2: barely any difference
- ΞAIC 2β6: moderate advantage for GLM
- ΞAIC > 10: strong advantage, LM clearly worse
Here you see the ΞAIC live. With binary data and count data the advantage of the GLM is typically large β with continuous, symmetric data the LM may be sufficient.