A straight line is a remarkably powerful model, but the world does not always hand us outcomes that behave like continuous measurements with constant variance.
Sometimes the outcome is yes or no. Sometimes it is a count. Sometimes it is a proportion bounded between zero and one. Sometimes the variability grows as the expected value grows. Generalized linear models, or GLMs, are one of statistics’ most important answers to that problem: keep a linear predictor, but connect it to an outcome distribution and a link function that actually fit the kind of data being modeled.
Quick Read
- A GLM extends ordinary linear regression to outcomes such as binary responses, counts, proportions and positive skewed measurements.
- Every GLM has three core pieces: an outcome distribution, a linear predictor and a link function connecting the predictor to the expected outcome.
- Logistic regression is a binomial GLM commonly used for binary outcomes.
- Poisson regression is a count model and can model rates through an exposure offset.
- The coefficients live on the link scale; interpretation usually requires translating them back to probabilities, rates or expected values.
- Maximum likelihood, deviance and residual diagnostics replace some of the familiar least-squares machinery.
- Overdispersion, separation, dependence, zero inflation, rare events and poor functional form can make a nominally valid GLM misleading.
- A GLM is still an associational model unless the study design and assumptions support a causal interpretation.
One-Sentence Answer
A generalized linear model works by expressing a transformed version of an outcome’s expected value as a linear combination of predictors while choosing a probability distribution whose variance structure matches the kind of outcome being analyzed.
1. Why Ordinary Linear Regression Is Not Enough
Ordinary least-squares regression is built for a continuous response whose conditional mean is modeled linearly and whose error behaviour is reasonably compatible with the model assumptions. It can be stretched surprisingly far, but some outcomes resist that stretch.
If the outcome is whether a student submitted an assignment, a fitted straight line can predict values below 0 or above 1. If the outcome is the number of breakdowns in a week, a Gaussian model can predict negative counts. If the variability of a count grows with its mean, a constant-variance assumption is structurally wrong rather than merely inconvenient.
GLMs were designed to keep the useful linear structure while respecting these different outcome types.
2. The Three-Part Architecture of a GLM
A generalized linear model combines three components.
- Random component: a probability distribution for the response, such as binomial, Poisson, Gaussian or Gamma.
- Systematic component: a linear predictor, usually written as η = β₀ + β₁x₁ + β₂x₂ + …
- Link function: a function g that connects the expected response μ to the linear predictor, so g(μ) = η.
This architecture matters because it separates two questions that ordinary regression often bundles together: what kind of random variation does the outcome have, and how do predictors combine to shift its expected value?
3. The Linear Predictor Is Still Linear in the Coefficients
“Generalized” does not mean the predictor side becomes arbitrary. The model still constructs a linear predictor from coefficients and variables. Predictors can include transformations, interactions, splines or indicator variables, but the coefficients enter through an organized linear combination.
This gives GLMs much of the interpretability and modularity of regression while allowing the response scale to behave differently.
4. The Link Function Is a Bridge Between Scales
The link function maps the expected response onto a scale where the linear predictor can operate sensibly.
- The identity link leaves the mean unchanged and gives the familiar linear-regression form.
- The logit link maps a probability between 0 and 1 to log-odds extending across the real line.
- The log link maps a positive expected count or rate to an unconstrained linear scale.
- The probit and complementary log-log links provide alternative ways to model probabilities.
The link is not cosmetic. It determines what a one-unit change in a predictor means before the result is translated back to the outcome scale.
5. Why the Exponential Family Appears So Often
Classical GLMs commonly use response distributions from the exponential family. This includes Gaussian, binomial, Poisson and Gamma distributions, among others. These distributions have a mathematical structure that makes likelihood-based estimation and variance modeling especially tractable.
The important practical idea is simpler than the algebra: different distributions encode different relationships between the expected value and the variability. A binary outcome cannot vary in the same way as an unrestricted continuous measurement; a Poisson count links its variance to its mean; a Gamma response is positive and can accommodate right-skewed continuous values.
6. Logistic Regression Is a Binomial GLM
For a binary outcome, logistic regression models the log-odds of the event as a linear function of predictors. The inverse-logit transformation then converts that linear predictor back into a probability between 0 and 1.
This solves a fundamental geometry problem. A predictor can range from very negative to very positive, yet the resulting probability can never fall below 0 or rise above 1.
7. Odds Ratios Are Not Probability Differences
Exponentiating a logistic-regression coefficient gives an odds ratio for a one-unit predictor change, holding the modeled covariates fixed. That is not the same thing as a fixed percentage-point change in probability.
The same odds ratio can correspond to very different probability changes depending on the baseline risk. Moving from 1% to 2% and moving from 40% to 57% are very different absolute changes even though multiplicative measures can sometimes look superficially similar.
For communication, predicted probabilities and marginal effects are often easier to understand than link-scale coefficients alone.
8. Poisson Regression Models Counts
A Poisson GLM commonly uses a log link. The expected count is positive, and exponentiated coefficients are interpreted multiplicatively on the expected-count scale.
For example, if one predictor is associated with an exponentiated coefficient of 1.20, the fitted expected count is multiplied by 1.20 for a one-unit change in that predictor, conditional on the rest of the model.
NIST describes the Poisson distribution as a model for the number of events occurring within a specified interval. The regression version extends that idea by allowing the expected count to depend on predictors.
9. Counts and Rates Are Not the Same Thing
Suppose School A records 20 late arrivals and School B records 40. School B may simply have twice as many students or twice as much observation time. Comparing raw counts can therefore confuse event frequency with exposure.
Poisson regression can model a rate by including the logarithm of exposure as an offset. The model then asks how the event rate changes after accounting for the amount of person-time, machine-time, distance, population or other opportunity for events to occur.
10. Binomial Models Can Also Handle Proportions
Binary data need not arrive one person at a time. If 73 of 100 inspected items pass, the response can be represented as successes out of trials. A binomial GLM models the success probability while retaining the denominator that tells us how much information the proportion contains.
A proportion of 0.70 based on 10 observations is not as precise as 0.70 based on 10,000 observations. The binomial likelihood preserves that difference.
11. Gamma GLMs for Positive, Right-Skewed Outcomes
Some continuous outcomes are strictly positive and strongly right-skewed. Waiting times, costs or positive physical measurements may have variability that increases with their mean. A Gamma GLM, often paired with a log link, can be more appropriate than forcing such an outcome into a constant-variance Gaussian model.
Distribution choice should follow the measurement process and residual behaviour, not a reflexive rule that every skewed variable must use Gamma regression.
12. Estimation Usually Comes From Maximum Likelihood
Ordinary least squares chooses coefficients by minimizing squared residuals. GLMs are usually estimated by maximizing a likelihood: the probability model is asked which coefficient values make the observed outcomes most plausible under the chosen distribution and link.
Software commonly solves this iteratively. The fitting process is therefore not just “drawing the best line.” It is finding a parameter vector that reconciles the systematic predictor structure with the assumed response distribution.
13. Deviance Plays a Role Similar to Residual Sum of Squares
GLMs use deviance to summarize how far the fitted model is from a saturated model that reproduces the observed responses as closely as possible. Differences in deviance can help compare nested models under appropriate conditions.
But a smaller deviance does not automatically mean a better scientific model. Adding parameters generally improves in-sample fit. Model selection still has to consider complexity, validation, interpretability, design and the intended decision.
14. Residuals Still Matter, but They Change Form
For non-Gaussian outcomes, raw residuals can be hard to interpret because their variance changes with the fitted mean. Analysts therefore use Pearson residuals, deviance residuals, randomized quantile residuals and other diagnostics suited to the model family.
Residual plots can reveal missing nonlinearity, outliers, overdispersion, unmodeled dependence or systematic prediction failures. A converged GLM is not a validated GLM.
15. Overdispersion Is a Structural Warning
In a simple Poisson model, the conditional mean and variance are tied together. Real count data are often more variable than that model allows. Unobserved heterogeneity, clustering, excess zeros or omitted predictors can produce overdispersion.
If overdispersion is ignored, standard errors may be too small and uncertainty understated. Remedies may include quasi-likelihood, negative-binomial models, random effects, cluster-robust inference or a better representation of the data-generating process.
16. Zero Inflation Is Not Just “A Lot of Zeros”
A dataset can have many zeros for several reasons. A standard count distribution may naturally generate them. The population may contain two distinct processes, one producing structural zeros and another producing counts. Or an exposure variable may be missing.
Zero-inflated and hurdle models can be useful when there is a defensible two-process story, but they should not be chosen solely because the histogram looks zero-heavy.
17. Complete Separation Can Break Logistic Estimation
If a predictor or combination of predictors perfectly separates the two outcome classes, ordinary maximum-likelihood logistic coefficients can run toward infinite magnitude. Software may warn about non-convergence, huge standard errors or fitted probabilities extremely close to 0 and 1.
Penalized likelihood, Bayesian priors, data redesign or predictor consolidation may be needed. The important lesson is that an apparently “perfect predictor” can be an estimation problem rather than a triumph.
18. Interactions Are Multiplicative on the Link Scale
An interaction says that the modeled effect of one predictor depends on another. In a GLM, that interaction is expressed on the link scale. Translating it to probabilities or rates can produce patterns that are less intuitive than the raw coefficient suggests.
For logistic models especially, interaction interpretation is usually clearer with predicted probabilities across meaningful combinations of predictors rather than coefficient arithmetic alone.
19. Nonlinearity in Predictors Is Different From a Non-Gaussian Outcome
A GLM solves a response-distribution problem; it does not automatically solve nonlinear predictor relationships. Age, temperature, practice time or income may have curved relationships with the outcome even after the correct family and link are chosen.
Polynomials, splines, piecewise terms or generalized additive models can address functional form. The family and the predictor shape are separate modeling decisions.
20. Independent Observations Are Still an Assumption
Students inside the same class, repeated observations from one person, transactions from the same store or events from the same machine may be correlated. A plain GLM that treats them as independent can underestimate uncertainty.
Generalized estimating equations, mixed-effects models, cluster-robust standard errors or explicit multilevel structures may be better choices. The outcome family does not magically remove dependence.
21. Prediction and Explanation Are Different Jobs
A GLM can be used to estimate associations, generate predictions, describe rates or support causal analysis. Those are not interchangeable objectives.
A predictive model may include variables that improve forecast accuracy without having a meaningful intervention interpretation. A causal model may need adjustment variables chosen from a causal structure rather than from automated significance testing. A descriptive model may prioritize transparent summary over maximal prediction.
22. A Regression Coefficient Does Not Become Causal Because the Model Is Sophisticated
Confounding, selection, measurement error, reverse causation and post-treatment adjustment can bias a GLM just as they can bias ordinary regression. Logistic or Poisson machinery changes the likelihood, not the causal design.
Randomization, natural experiments, causal diagrams, temporal ordering and defensible identification assumptions remain the things that justify causal language.
23. Rare Events and Class Imbalance Need Care
When positive outcomes are very rare, a model can achieve high raw accuracy by predicting the majority class almost all the time. Logistic coefficients may also become unstable when events per parameter are scarce.
Evaluation should therefore examine calibration, precision, recall, thresholds and uncertainty rather than accuracy alone. Penalization or Bayesian shrinkage may improve stability, but no algorithm can manufacture information that the dataset does not contain.
24. Regularisation Changes the Estimation Goal
Ridge, lasso and elastic-net penalties can be applied to GLMs to reduce overfitting or handle many correlated predictors. The resulting coefficients are deliberately shrunk. This often improves prediction but means the estimates are no longer the same maximum-likelihood solution as the unpenalized model.
Regularization strength should be selected using a validation procedure that respects the data structure.
25. A Worked Intuition: Modeling Absence Counts
Imagine comparing the number of absence days across students. A student enrolled for an entire year has more opportunity to accumulate absences than a student who joined late. Raw counts therefore mix behaviour with exposure.
A count model could use days enrolled as an exposure term, then examine whether expected absence rates differ with other measured variables. If the counts show much more variability than Poisson permits, a negative-binomial model may fit better. If students are clustered inside classes, a multilevel count model may be necessary. If the purpose is causal, the adjustment set must come from a causal argument rather than whatever variables happen to be available.
The example shows why GLM work is not “choose Poisson and press run.” Distribution, exposure, dependence and interpretation all matter.
26. A Responsible GLM Workflow
- Define the outcome precisely. Binary event, count, rate, proportion or positive continuous measurement?
- Identify the unit of observation. Person, transaction, day, school, machine or repeated episode?
- Check exposure and denominators. Counts without opportunity can be misleading.
- Choose a family from the data-generating story. Do not choose by habit.
- Choose and justify the link. Interpretation lives on that scale.
- Specify predictor form. Add interactions or nonlinear terms only where justified.
- Fit the model and inspect convergence. Numerical convergence is necessary, not sufficient.
- Check residuals, dispersion and influence. Look for structural misfit.
- Respect clustering and repeated measures. Dependence needs explicit treatment.
- Validate predictions out of sample when prediction is the goal.
- Translate results back to the outcome scale. Probabilities and rates are often more useful than log-odds.
- Report uncertainty and limitations. The model is a representation, not the world itself.
27. Common Failure Modes
- Using ordinary linear regression for a bounded probability and accepting impossible predictions.
- Interpreting an odds ratio as a fixed probability increase.
- Comparing counts without accounting for different exposure.
- Using Poisson regression despite severe unaddressed overdispersion.
- Choosing a zero-inflated model merely because many observations are zero.
- Ignoring separation or convergence warnings in logistic regression.
- Assuming the correct outcome family guarantees the predictor relationship is correctly specified.
- Treating clustered observations as independent.
- Selecting variables only by p-values and then telling a causal story.
- Reporting link-scale coefficients without translating them into meaningful quantities.
- Judging a rare-event classifier by accuracy alone.
- Using the same data to choose, fit and evaluate a complex model without honest validation.
28. How This Connects Across the eduKate Library
- How Regression Models Work — the broader regression owner; this page specializes the non-Gaussian response branch.
- How Probability Distributions and Sampling Distributions Work — the probability foundation beneath binomial, Poisson and other response families.
- How Clustered and Multilevel Data Work — the route when observations are nested or repeatedly measured.
- How Model Selection, Regularisation and Cross-Validation Work — for shrinkage, tuning and honest predictive validation.
- How Causal Inference Works — for deciding when an adjusted coefficient may support a causal claim.
- How Measurement Error and Misclassification Work — because noisy predictors and outcomes can distort GLM estimates.
- How Missing Data Analysis Works — for incomplete covariates and outcomes.
29. Authoritative Sources and Further Reading
- R Core Team, R stats documentation: Fitting Generalized Linear Models — official documentation for the base R
glmimplementation and family/link specification. - NIST/SEMATECH, e-Handbook of Statistical Methods — broad official statistical reference, including regression, distributions and diagnostics.
- NIST, Poisson Distribution — definition and properties of the Poisson count distribution.
- NIST, Linear Least Squares Regression — useful for understanding what GLMs retain from and change about the ordinary regression framework.
- NIST, Poisson Dispersion Test — background on assessing Poisson dispersion behaviour.
Final Idea
The deep idea behind a generalized linear model is not that statistics found a more complicated line. It is that the mean, the variance and the scale on which predictors combine have to agree with the kind of thing being measured. Once those pieces are aligned, binary events, counts, rates and positive outcomes can be modeled with the same disciplined architecture. When they are not aligned, sophisticated software merely gives a precise answer to the wrong statistical question.