AI Glossary / Statistics and probability / Intermediate
Generalized linear model
Definition
A generalized linear model, or GLM, relates an outcome’s conditional mean to a linear combination of predictors through a link function, while specifying an appropriate response distribution. The framework includes ordinary normal linear regression, logistic regression for binary outcomes, and Poisson regression for counts. It extends the ordinary linear-model framework without requiring every outcome to have constant-variance normal errors or an unrestricted numerical mean.
What it means
Different outcomes require different models. A purchase indicator can only be zero or one, a request count cannot be negative, and an ordinary continuous measurement may have a much broader range. A GLM connects the mean to predictors in a way suited to the outcome.
Three ingredients work together: the response family, the linear predictor, and the link. A binomial family with a logit link, for example, converts an unrestricted linear predictor into a probability between zero and one.
“Generalized” does not mean that every possible nonlinear model belongs to this class. “Linear” refers to the predictor’s coefficients, while the relationship between predictors and the outcome mean can be nonlinear after applying the inverse link.
How it works
Specify η_i = β0 + β1x_i1 + … and g(μ_i) = η_i, where μ_i is the conditional mean and g is the link. Predictions use μ_i = g⁻¹(η_i). The response family supplies the distributional and mean-variance structure used for fitting and inference.
Estimate coefficients, commonly by maximum likelihood through an iterative procedure. Include suitable category coding, transformations, or interactions when justified. For counts observed over different exposures, a log-exposure offset can account for the amount of opportunity for events to occur.
Check convergence, residual behavior, calibration, dispersion, influential observations, and performance on appropriate held-out data. Standard independent-observation assumptions may fail with repeated measurements. The choice of family and link is substantive, not simply a software setting to accept without considering the data-generating process.
Three practical examples
- Customer behavior: use logistic regression to model a purchase probability from information available before the purchase decision.
- Operations: use a count model to estimate service requests over differing observation periods, with an exposure offset when its proportionality assumption is appropriate.
- Process analysis: use a suitable positive-response family to study a strictly positive, skewed measurement, evaluating whether its variance pattern and link fit the application.
Think of it this way
Think of a translator between two numerical languages. The linear predictor speaks in unrestricted scores; the inverse link translates those scores into the language of the outcome mean, such as probabilities or positive rates. The response family separately describes how observed outcomes vary around that mean.
Worked example
Suppose a constructed Poisson model for event counts uses a log link and exposure E measured in days. Its declared prediction equation is log(μ) = log(E) + log(2) + x log(1.5). These coefficients are hypothetical for illustration, rather than estimates from an unstated dataset.
For a one-day exposure and x = 0, the expected count is exp(log(2)) = 2. Increasing x to 1 multiplies the expected rate by 1.5, giving 3 events per day. At x = 2, the rate is 2 × 1.5² = 4.5 events per day.
For E = 10 days and x = 2, μ = 10 × 4.5 = 45 events. Direct exponentiation of the linear predictor independently confirms the result. The coefficient log(1.5), approximately 0.4055, represents a multiplicative rate change after exponentiation; it is not an additional 0.4055 events. Under the stated Poisson distribution, conditional variance also equals 45. If observed variability substantially exceeds that relationship, the model needs investigation rather than automatic acceptance.
Illustrative case study
Fictional case: BrightDesk compares support-request counts across customers. Its first analysis overlooks that some customers were observed for one week and others for several months.
The team defines exposure consistently, fits a Poisson GLM with a log-exposure offset, and evaluates whether rates scale proportionally with exposure. It checks whether customer differences and repeated observations create excess variation or dependence. The final report presents predicted counts for explicit exposure periods, with uncertainty and validation results, rather than comparing incompatible raw counts.
Common misconceptions and mistakes
- Confusing a generalized linear model with the narrower general linear model.
- Treating a link function as an instruction to transform the observed outcome and run ordinary least squares. In general, these are different procedures.
- Reading a log-link coefficient as an additive change on the original outcome scale.
- Interpreting a logistic odds ratio as a risk ratio or a fixed percentage-point probability change.
- Ignoring overdispersion, separation in binary models, or dependence between observations.
- Assuming that an acceptable fitted mean proves the full response distribution is appropriate.
Business use
GLMs provide a practical bridge between interpretable regression and the varied outcomes found in business. They can support forecasting, adjusted comparisons, and transparent baseline models when the outcome family and mean relationship are well chosen.
Document the outcome definition, family, link, predictor coding, exposure units, and analysis population. Translate results onto meaningful scales, such as predicted probabilities at specified customer profiles or expected requests over a stated period. Validate those predictions under the conditions in which they will be used. Coefficients remain conditional associations unless the research design supports causal conclusions.
People also ask
Is ordinary linear regression a GLM?
Yes, normal errors with an identity link give the familiar normal linear-regression case.
Does every GLM use a log link?
No. The link depends on the family and modeling objective; identity and logit links are common examples.
Can a GLM contain interactions?
Yes. An interaction can be a column in the linear predictor, provided its interpretation and data support are considered.
Check your understanding
Answer: 1. A log-link coefficient is log(2).
What does a one-unit predictor increase do to the mean, holding other terms fixed?
Answer: It multiplies the mean by two. 2.
Why include exposure for comparable event rates?
Answer: Different observation opportunities can generate different counts even at the same underlying rate. 3.
Does the inverse link transform observed outcomes or the linear predictor?
Answer: It transforms the linear predictor into the modeled mean.
Related terms
- General linear model
- Logistic regression
- Poisson regression
- Exponential family
- link function
- maximum likelihood
- offset
- overdispersion
Learn next
Compare identity, logit, and log links using simple predictions. Then examine the difference between modeling a transformed mean and transforming observations. Practice reporting predictions in original units and checking the family’s variance assumptions.
More in Statistics and probability
- General regression neural network - A general regression neural network, or GRNN, is a memory-based method for predicting numerical outcomes by combining the outcomes of stored training...
- Generalized estimating equation - A generalized estimating equation, usually discussed in the plural as generalized estimating equations or GEE, estimates relationships between predictors...
- Generalized likelihood uncertainty estimation - Generalized likelihood uncertainty estimation, or GLUE, is a framework for exploring uncertainty in model predictions by retaining multiple acceptable model...
- Generalized p-value - A generalized p-value is a hypothesis-testing quantity constructed using a generalized test variable whose reference distribution removes dependence on...
- Generalized pairwise comparisons - Generalized pairwise comparisons are methods for comparing two groups by evaluating pairs containing one observation from each group according to a...
- Generalized Procrustes analysis - Generalized Procrustes analysis, or GPA, aligns several configurations of corresponding points to a common consensus by removing specified differences in...
Sources
Statsmodels, Generalized Linear Models: https://www.statsmodels.org/stable/glm.html — formal mean, link, family, and variance relationships read.
Google, Machine Learning Glossary: https://developers.google.com/machine-learning/glossary — generalized-linear-model terminology and examples checked. This entry distinguishes model structure from feature engineering. All numerical scenarios and the business case are original.
Previous: Generalized linear mixed model Next: Generalized minimum-distance decoding