Generalized Linear Models Explained: A Practical Guide to 8 Regression Types Including Poisson and Negative Binomial

    This guide introduces the generalized linear model (GLM) framework and its three core components, then walks through eight common regression types and their use cases. It provides practical guidance on Poisson and negative binomial regression for count data, including overdispersion diagnostics and Python code examples, followed by a general methodology for model selection, typical application scenarios, and common pitfalls to avoid.

    Generalized Linear Models Explained: A Practical Guide to 8 Regression Types Including Poisson and Negative Binomial

    1. What Is a Generalized Linear Model?

    A generalized linear model (GLM) is a flexible statistical modeling framework that extends traditional linear regression to response variables that do not follow a normal distribution. In real-world business and research settings, the dependent variable is often neither continuous nor symmetrically distributed—for example, the number of support tickets in a day, whether a user clicks an ad, or a patient’s length of hospital stay. Forcing ordinary least squares regression onto such data leads to out-of-range predictions, distorted confidence intervals, and invalid hypothesis tests.

    A GLM consists of three core components:

    1. Random component: The dependent variable Y follows a distribution from the exponential family (normal, binomial, Poisson, gamma, etc.);
    2. Systematic component: A linear combination of the predictors, η = β₀ + β₁x₁ + … + βₚxₚ;
    3. Link function: Connects the expected value of the response to the linear predictor, i.e., g(E[Y]) = η.

    The combination of these three elements determines model behavior. For example, linear regression is a special case of GLM (normal distribution + identity link), logistic regression corresponds to a binomial distribution + logit link, and Poisson regression corresponds to a Poisson distribution + log link.

    2. Eight Common Regression Types and When to Use Them

    In statistical modeling practice, the most commonly used regression types in the GLM family can be grouped into the following eight:

    1. Linear Regression

    Used when the dependent variable is continuous and approximately normally distributed, with an identity link function. Suitable for scenarios such as height or sales forecasting. Key assumptions include independent residuals and homoscedasticity.

    2. Logistic Regression

    Used when the dependent variable is binary (0/1). It applies a logit link function and outputs the probability of an event occurring. Widely used in credit risk assessment, disease diagnosis, and marketing conversion prediction.

    3. Poisson Regression

    Used for count data (non-negative integers) with a log link function. Suitable for modeling the number of events per unit of time or space, such as daily customer service inquiries or traffic accidents at an intersection.

    4. Negative Binomial Regression

    When count data exhibits overdispersion (variance clearly greater than the mean), Poisson regression underestimates standard errors and inflates significance. Negative binomial regression introduces an additional dispersion parameter and serves as an important complement to Poisson regression.

    5. Ordinal Logit Regression

    Used when the dependent variable is an ordered categorical variable, such as satisfaction levels (poor/average/good). A cumulative logit model is commonly used to capture the ordered structure across categories.

    6. Multinomial Logit Regression

    Used when the dependent variable is an unordered categorical variable, such as a user’s choice of transportation (bus/subway/driving).

    7. Gamma Regression

    Used when the dependent variable is strictly positive, continuous, and right-skewed, such as insurance claim amounts or equipment repair times. A log link function ensures positive predictions.

    8. Inverse Gaussian Regression

    Suitable for right-skewed data whose variance grows rapidly with the mean; occasionally applied in actuarial and reliability analysis.

    3. Practical Tips for Poisson and Negative Binomial Regression

    1. Model Form

    Poisson regression assumes:

    1. log(E[Y|X]) = β₀ + β₁x₁ + … + βₚxₚ
    2. E[Y|X] = Var(Y|X) (mean equals variance)

    Interpreting coefficients: holding other variables constant, a one-unit increase in x multiplies the expected event count by exp(β).

    2. Diagnosing Overdispersion

    The Poisson distribution requires the mean to equal the variance, but real data often shows variance far greater than the mean. Common diagnostic methods include:

    • Dispersion statistic: If the Pearson chi-square divided by the degrees of freedom is significantly greater than 1 (e.g., above 1.5), this suggests overdispersion;
    • Residual diagnostic plots: Check whether residuals spread out as fitted values increase;
    • Zero-inflation check: If the proportion of zero counts in the data far exceeds what the Poisson distribution predicts, consider a zero-inflated model.

    3. How Negative Binomial Regression Handles It

    The negative binomial distribution can be viewed as a “Poisson + gamma mixture,” meaning the event rate itself has individual-level heterogeneity. It introduces a dispersion parameter α, allowing the variance to be expressed as:

    1. Var(Y) = μ + αμ²

    As α → 0, the model reduces to Poisson regression. In practice, testing whether α is significant is a common way to decide whether a negative binomial model is needed.

    4. Example Code (Python Ecosystem)

    1. import numpy as np
    2. import statsmodels.api as sm
    3. # Assume X is the predictor matrix and y is the count response
    4. X = sm.add_constant(X)
    5. # Poisson regression
    6. poi = sm.GLM(y, X, family=sm.families.Poisson()).fit()
    7. print(poi.summary())
    8. # Negative binomial regression (estimates the dispersion parameter alpha)
    9. nb = sm.NegativeBinomial(y, X).fit(method='bfgs')
    10. print(nb.summary())

    Fitting a Poisson model first to check dispersion, then comparing with a negative binomial model, is the most reliable modeling path.

    4. A General Methodology for Model Selection

    Choose based on the range and distribution shape of the dependent variable: linear regression for continuous, approximately normal data; logistic regression for binary outcomes; Poisson/negative binomial for counts; Gamma for right-skewed continuous data.

    2. Comparing Goodness of Fit

    Compare candidate models using metrics such as AIC, BIC, and log-likelihood; use a likelihood ratio test for nested models.

    3. Residual and Influential Point Diagnostics

    Examine the distribution and patterns of deviance residuals to identify outliers and influential observations.

    4. Interpretability and Stability

    Don’t chase statistical metrics alone—interpret the direction and magnitude of coefficients in light of business meaning, and evaluate generalization through cross-validation.

    5. Typical Application Scenarios

    • Medical research: Modeling count outcomes such as length of hospital stay and number of recurrences;
    • Internet operations: Predicting user visit counts and click counts;
    • Insurance actuarial work: The classic combination of claim counts (Poisson/negative binomial) and claim amounts (Gamma);
    • Quality management: Analyzing defect counts per unit of product;
    • Transportation and public safety: Spatiotemporal modeling of accident frequency.

    6. Common Pitfalls and Precautions

    1. Misusing linear regression for count data: This produces negative predicted values and meaningless confidence intervals;
    2. Ignoring overdispersion: Using Poisson regression directly leads to overly optimistic parameter tests;
    3. Overlooking skewed continuous variables: For right-skewed monetary data, Gamma regression is usually preferable to ordinary linear regression;
    4. Choosing the wrong link function: For example, using an identity link for binary outcomes may push predicted probabilities outside the [0,1] range;
    5. Failing to address multicollinearity: Count models are equally affected by collinearity, so check correlations and variance inflation factors first.

    7. Summary

    Through its modular “distribution family + link function” design, the generalized linear model extends the power of linear models to nearly all common data types: categorical, count, and skewed continuous. Mastering the boundaries of the eight typical regression types—especially how Poisson and negative binomial regression divide the work for count data—is a key step for data analysts moving from “running models” to “choosing the right model.” In practice, always start from the distribution of the dependent variable, combine overdispersion diagnostics with multi-model comparison, and build a modeling workflow that is both statistically rigorous and business-interpretable.