Tutorials › Biostatistics › Generalized Linear Models (GLMs) Overview

Regression & Generalized Linear Models

Generalized Linear Models (GLMs) Overview

A practical introduction to generalized linear models, explaining how GLMs extend ordinary linear regression to binary, count, proportion, and other non-normal clinical outcomes through the use of probability distributions and link functions.

Intermediate 18 min read

What You'll Learn

  • What a generalized linear model is and why it extends ordinary linear regression
  • How the response distribution, linear predictor, and link function work together
  • How logistic, Poisson, and negative binomial regression fit into the GLM framework
  • How to interpret coefficients, odds ratios, rate ratios, and predicted means
  • How maximum likelihood estimation and deviance are used in GLMs
  • How to choose an appropriate GLM for a clinical endpoint

Introduction

Clinical trial endpoints do not all behave like normally distributed continuous measurements.

A laboratory measurement such as change in hemoglobin may be approximately continuous and reasonably modeled with ordinary linear regression. But many important clinical outcomes are fundamentally different.

Examples include:

  • Response versus no response
  • Occurrence versus non-occurrence of an adverse event
  • Number of seizures during follow-up
  • Number of exacerbations
  • Number of hospitalizations
  • Proportion of patients responding
  • Positive or negative diagnostic outcomes

Applying ordinary linear regression to these outcomes can produce inappropriate predictions, incorrect variance assumptions, or coefficients that are difficult to interpret clinically.

Generalized linear models (GLMs) provide a unified framework for modeling many of these non-normal outcomes.

Key idea: A GLM combines three ingredients: a probability distribution for the outcome, a linear predictor for the covariates, and a link function connecting the expected outcome to that linear predictor.

From Linear Regression to GLMs

Ordinary linear regression can be written as:

$$ Y_i=\beta_0+\beta_1X_{i1}+\beta_2X_{i2}+\cdots+\beta_pX_{ip}+\varepsilon_i $$

The model assumes that the conditional mean of \(Y\) is a linear function of the predictors:

$$ E(Y_i\mid X_i)=\beta_0+\beta_1X_{i1}+\cdots+\beta_pX_{ip} $$

A key feature of ordinary linear regression is that the predicted mean can, in principle, take any real value.

That is reasonable for some continuous outcomes, but not for a probability or a count.

For example, a model for probability should never predict:

$$ P(Y=1\mid X)=-0.20 $$

or:

$$ P(Y=1\mid X)=1.25 $$

A GLM solves this problem by allowing the linear predictor to operate on a transformed scale.

The Three Components of a GLM

Every standard GLM can be understood through three components:

1
Random component: specifies the probability distribution of the outcome, such as normal, binomial, Poisson, or another exponential-family distribution.
2
Systematic component: defines the linear predictor using explanatory variables.
3
Link function: connects the expected outcome to the linear predictor.

These three components are the foundation of the entire GLM framework.

The Linear Predictor

The systematic portion of a GLM is usually written as:

$$ \eta_i = \beta_0+\beta_1X_{i1}+\beta_2X_{i2}+\cdots+\beta_pX_{ip} $$

The quantity \(\eta_i\) is called the linear predictor.

It has the same basic structure as ordinary linear regression.

For example, suppose a clinical trial models the probability of response using treatment and baseline disease severity:

$$ \eta_i = \beta_0+\beta_1\operatorname{Treatment}_i+ \beta_2\operatorname{Severity}_i $$

The difference is that the linear predictor does not necessarily equal the expected outcome itself.

Instead, it is connected to the expected outcome through the link function.

The Link Function

A GLM uses a link function \(g(\cdot)\) such that:

$$ g(\mu_i)=\eta_i $$

where:

  • \(\mu_i=E(Y_i\mid X_i)\) is the conditional mean.
  • \(\eta_i\) is the linear predictor.
  • \(g(\cdot)\) is the link function.

Equivalently:

$$ \mu_i=g^{-1}(\eta_i) $$

where \(g^{-1}\) is the inverse link function.

Why use a link? The link function transforms the expected outcome onto a scale where an unrestricted linear predictor is appropriate. The inverse link then converts the linear predictor back to the clinically meaningful scale.

Common GLMs at a Glance

Outcome Common Distribution Common Link Typical Model
Continuous normal outcome Normal Identity Linear regression
Binary outcome Binomial Logit Logistic regression
Count outcome Poisson Log Poisson regression
Overdispersed count Negative binomial Log Negative binomial regression
Positive continuous outcome Gamma Log Gamma regression

The Exponential Family

The standard GLM framework is based on probability distributions belonging to the exponential family.

A common representation is:

$$ f(y;\theta,\phi) = \exp \left[ \frac{y\theta-b(\theta)}{a(\phi)} +c(y,\phi) \right] $$

where \(\theta\) is the canonical parameter and \(\phi\) is a dispersion parameter when one is present.

The important practical point is not memorizing this expression.

The important point is that many familiar probability distributions can be handled within the same modeling framework.

Examples include:

  • Normal
  • Binomial
  • Poisson
  • Gamma
  • Inverse Gaussian
Practical interpretation: The GLM framework allows the statistical model to change according to the nature of the endpoint while preserving a common regression structure.

GLMs vs. Ordinary Linear Regression

Feature Linear Regression GLM
Outcome distribution Typically normal Chosen from an appropriate family
Mean relationship Directly linear Linear after applying a link
Variance Typically constant Can depend on the mean
Binary outcomes Generally inappropriate Logistic regression
Count outcomes Generally inappropriate Poisson or negative binomial
Estimation Often least squares Usually maximum likelihood

Logistic Regression as a GLM

One of the most important GLMs in clinical research is logistic regression.

Suppose \(Y_i\) is a binary endpoint:

$$ Y_i= \begin{cases} 1,&\text{response}\\ 0,&\text{no response} \end{cases} $$

Then:

$$ Y_i\sim\operatorname{Bernoulli}(p_i) $$

where \(p_i\) is the probability of response.

The logistic link is:

$$ \operatorname{logit}(p_i) = \log\left(\frac{p_i}{1-p_i}\right) = \eta_i $$

Thus:

$$ \log\left(\frac{p_i}{1-p_i}\right) = \beta_0+\beta_1X_{i1}+\cdots+\beta_pX_{ip} $$

The inverse transformation gives:

$$ p_i = \frac{\exp(\eta_i)} {1+\exp(\eta_i)} $$

The inverse logit ensures that the predicted probability always lies between 0 and 1.

Interpreting a Logistic Regression Coefficient

Suppose:

$$ \operatorname{logit}(p) = \beta_0+\beta_1X $$

A one-unit increase in \(X\) changes the log odds by \(\beta_1\).

Exponentiating gives the odds ratio:

$$ OR=\exp(\beta_1) $$

For example, if:

$$ \beta_1=0.693 $$

then:

$$ OR=\exp(0.693)\approx2.00 $$

A one-unit increase in \(X\) is associated with approximately twice the odds of the outcome, holding the other model covariates constant.

Important: An odds ratio is not the same thing as a risk ratio or probability difference. For common outcomes, these measures can differ substantially.

Poisson Regression as a GLM

Count outcomes require a different probability model.

Suppose \(Y_i\) represents the number of clinical events experienced by patient \(i\).

A Poisson model assumes:

$$ Y_i\sim\operatorname{Poisson}(\mu_i) $$

The Poisson mean and variance are both:

$$ E(Y_i)=\mu_i $$ $$ \operatorname{Var}(Y_i)=\mu_i $$

The standard link is the log link:

$$ \log(\mu_i)=\eta_i $$

Therefore:

$$ \log(\mu_i) = \beta_0+\beta_1X_{i1}+\cdots+\beta_pX_{ip} $$

and:

$$ \mu_i=\exp(\eta_i) $$

Interpreting a Poisson Regression Coefficient

Exponentiating a Poisson coefficient gives a multiplicative effect on the expected event rate:

$$ RR=\exp(\beta_1) $$

This is often called a rate ratio or incidence rate ratio, depending on the analysis.

For example, if:

$$ \beta_1=-0.223 $$

then:

$$ \exp(-0.223)\approx0.80 $$

The expected event rate is approximately 20% lower for a one-unit increase in the predictor, all else equal.

Exposure Time and the Offset

Clinical count outcomes frequently have unequal observation times.

For example, one patient may be followed for 12 months while another is followed for only 6 months.

Simply modeling the raw number of events can therefore be misleading.

A Poisson model can incorporate exposure using an offset:

$$ \log(E[Y_i]) = \log(t_i) + \beta_0+\beta_1X_{i1}+\cdots+\beta_pX_{ip} $$

where \(t_i\) is the exposure time.

Equivalently:

$$ \log\left(\frac{E[Y_i]}{t_i}\right) = \beta_0+\beta_1X_{i1}+\cdots+\beta_pX_{ip} $$

The model therefore compares event rates rather than simply event counts.

Negative Binomial Regression

A major limitation of the Poisson model is its equidispersion assumption:

$$ \operatorname{Var}(Y)=E(Y) $$

Clinical event data frequently violate this assumption.

For example, suppose the mean number of exacerbations is 2.0 but the variance is 7.5.

The data are substantially more variable than a Poisson model expects.

This phenomenon is called overdispersion.

Negative binomial regression introduces an additional dispersion parameter and can accommodate variance greater than the mean.

A common parameterization has:

$$ E(Y)=\mu $$ and: $$ \operatorname{Var}(Y) = \mu+\alpha\mu^2 $$

where \(\alpha>0\) controls the degree of overdispersion.

Clinical rule of thumb: When count data show substantial overdispersion, negative binomial regression is often more appropriate than ordinary Poisson regression.

Gamma Regression

GLMs can also be used for positive continuous outcomes.

Suppose the endpoint is a strictly positive measure such as:

  • Time spent in hospital
  • Cost
  • Biomarker concentration
  • Duration of a positive-valued clinical measurement

If the distribution is strongly right-skewed, a Gamma GLM may be useful.

A common choice is the log link:

$$ \log(\mu_i)=\eta_i $$

so that:

$$ \mu_i=\exp(\eta_i) $$

The log link guarantees positive predicted means.

The Identity Link

The identity link is:

$$ g(\mu)=\mu $$

This means:

$$ \mu_i=\eta_i $$

Ordinary linear regression can therefore be viewed as a special case of the GLM framework using a normal response distribution and identity link.

Unifying perspective: Ordinary linear regression is not completely separate from GLMs. It occupies one important position within the broader generalized linear modeling framework.

Canonical Link Functions

Each exponential-family distribution has a corresponding canonical link.

Distribution Canonical Link Common Clinical Model
Normal Identity Linear regression
Binomial Logit Logistic regression
Poisson Log Poisson regression
Gamma Inverse Gamma regression

The canonical link has useful mathematical properties, but it is not mandatory that every analysis use the canonical link.

For example, binomial data may sometimes be modeled with a log link when a risk-ratio interpretation is desired and the modeling assumptions are appropriate.

Mean-Variance Relationship

One of the most important conceptual differences between GLMs concerns how the variance depends on the mean.

In a normal model:

$$ \operatorname{Var}(Y)=\sigma^2 $$

The variance is constant under the standard model.

For a Poisson model:

$$ \operatorname{Var}(Y)=\mu $$

For a binomial model with fixed \(n\):

$$ \operatorname{Var}(Y)=np(1-p) $$

Thus, the distributional assumption determines not only the shape of the outcome distribution but also its relationship between mean and variance.

Why the Variance Assumption Matters

Suppose two clinical datasets both have a mean count of 4.

Dataset Mean Variance Possible Model
A 4.0 4.2 Poisson may be reasonable
B 4.0 18.0 Negative binomial may be preferable

The same mean does not imply the same probability model.

Model selection therefore requires attention to both the expected outcome and the observed variability.

Likelihood-Based Estimation

GLM coefficients are commonly estimated using maximum likelihood.

The likelihood represents how plausible the observed data are for a given set of model parameters.

If the observations are independent, the likelihood is:

$$ L(\boldsymbol{\beta}) = \prod_{i=1}^{n} f(y_i\mid\boldsymbol{x}_i,\boldsymbol{\beta}) $$

It is usually easier computationally to maximize the log-likelihood:

$$ \ell(\boldsymbol{\beta}) = \sum_{i=1}^{n} \log f(y_i\mid\boldsymbol{x}_i,\boldsymbol{\beta}) $$

The estimated coefficient vector is the value that maximizes this quantity.

Why maximum likelihood? Unlike ordinary least squares, GLMs must accommodate non-normal outcome distributions. Maximum likelihood provides a general estimation framework that works across many of those distributions.

What Is Deviance?

Deviance is one of the central model-comparison quantities used in GLMs.

Conceptually, it compares the fitted model with a saturated model that fits the observed data as closely as possible.

The deviance is commonly expressed as:

$$ D = 2\left[ \ell_{\text{saturated}} - \ell_{\text{fitted}} \right] $$

Smaller deviance generally indicates a model that fits the observed data better, all else being equal.

For nested models, the difference in deviance can often be used to test whether additional predictors improve model fit.

Null Deviance and Residual Deviance

Statistical software often reports:

  • Null deviance: deviance for a model containing only an intercept.
  • Residual deviance: deviance for the fitted model containing the specified predictors.

The difference:

$$ D_{\text{null}}-D_{\text{residual}} $$

quantifies the improvement in fit obtained by adding the predictors.

For nested models, this difference can be evaluated using an appropriate likelihood-ratio test.

AIC and BIC

Two common information criteria are:

$$ AIC=-2\ell+2k $$

and:

$$ BIC=-2\ell+k\log(n) $$

where:

  • \(\ell\) is the maximized log-likelihood.
  • \(k\) is the number of estimated parameters.
  • \(n\) is the sample size.

Both criteria balance goodness of fit against model complexity.

Lower values are generally preferred when comparing competing models fitted to the same dataset and outcome.

Important: AIC and BIC should not be treated as automatic substitutes for clinical or scientific reasoning. A model with a slightly lower AIC is not necessarily the clinically appropriate model.

Interpreting GLM Coefficients

The meaning of a regression coefficient depends strongly on the link function.

Model Link Coefficient Scale Exponentiated Coefficient
Linear regression Identity Mean difference Usually not needed
Logistic regression Logit Change in log odds Odds ratio
Poisson regression Log Change in log mean/rate Rate ratio
Negative binomial Log Change in log mean/rate Rate ratio
Gamma regression Log Change in log mean Mean ratio

A Simple Clinical Example

Suppose a randomized Phase III trial evaluates whether treatment reduces the number of disease exacerbations during one year.

The primary analysis variable is the number of exacerbations per patient.

A possible modeling strategy is:

$$ Y_i\sim\operatorname{NegativeBinomial}(\mu_i,\alpha) $$

with:

$$ \log(\mu_i) = \beta_0+ \beta_1\operatorname{Treatment}_i+ \beta_2\operatorname{BaselineSeverity}_i $$

Suppose the estimated treatment coefficient is:

$$ \hat{\beta}_1=-0.357 $$

Then:

$$ \exp(-0.357)\approx0.70 $$

The treatment-associated rate ratio is approximately 0.70.

Holding the other covariates constant, the estimated exacerbation rate is approximately 30% lower in the treatment group than in the reference group.

Interpret carefully: A rate ratio of 0.70 does not necessarily mean that 30% fewer patients experienced an event. It means that the modeled event rate is approximately 70% of the reference rate.

Binary Outcomes: Logistic vs. Linear Probability Models

A binary endpoint can technically be modeled using ordinary linear regression, creating what is called a linear probability model.

For example:

$$ P(Y=1\mid X)=\beta_0+\beta_1X $$

However, the fitted values may fall outside the interval \([0,1]\).

Logistic regression avoids this problem through the inverse-logit transformation.

$$ P(Y=1\mid X) = \frac{\exp(\eta)} {1+\exp(\eta)} $$

This is one reason logistic regression is generally preferred for standard binary-outcome modeling.

Counts: Poisson vs. Negative Binomial

For count outcomes, a common decision is whether to use Poisson or negative binomial regression.

1
Start with the scientific endpoint. Confirm that the outcome represents a count and determine the relevant observation or exposure period.
2
Assess dispersion. Compare the variability of the counts with what the Poisson model expects.
3
Consider exposure. If follow-up differs, determine whether an offset is needed.
4
Compare candidate models. Use scientific reasoning, diagnostics, likelihood-based measures, and prespecified analysis considerations.

GLMs and Clinical Trial Covariates

GLMs can include many of the covariates commonly encountered in clinical trials.

Examples include:

  • Treatment group
  • Age
  • Sex
  • Baseline disease severity
  • Geographic region
  • Prior treatment
  • Baseline biomarker level
  • Stratification factors

For example, logistic regression might model response as:

$$ \operatorname{logit}(p_i) = \beta_0+ \beta_1\operatorname{Treatment}_i+ \beta_2\operatorname{Age}_i+ \beta_3\operatorname{Baseline}_i $$

The treatment coefficient then represents the treatment association after accounting for the other included covariates.

Categorical Predictors

Categorical clinical variables can be incorporated through indicator variables.

Suppose treatment has three groups:

  • Placebo
  • Low dose
  • High dose

Using placebo as the reference, two indicator variables can be created:

$$ \eta_i = \beta_0+ \beta_1I(\text{Low Dose})+ \beta_2I(\text{High Dose}) $$

Then:

$$ \exp(\beta_1) $$

represents the effect of low dose relative to placebo on the relevant multiplicative scale, while:

$$ \exp(\beta_2) $$

represents the high-dose effect relative to placebo.

Interactions in GLMs

GLMs can also include interactions.

For example:

$$ \eta_i = \beta_0+ \beta_1T_i+ \beta_2S_i+ \beta_3(T_iS_i) $$

where \(T_i\) is treatment and \(S_i\) is a subgroup indicator.

The interaction coefficient \(\beta_3\) tests whether the treatment effect differs according to subgroup status on the model's link-function scale.

Important: An interaction is not simply another main effect. Interpretation must account for the model's coding, reference groups, and link function.

Confidence Intervals

GLM coefficients are usually reported with confidence intervals.

For a coefficient \(\hat{\beta}\), a large-sample Wald interval is often:

$$ \hat{\beta} \pm z_{1-\alpha/2} SE(\hat{\beta}) $$

For a multiplicative parameter such as an odds ratio or rate ratio, the interval is commonly obtained by exponentiating the coefficient-scale limits.

$$ CI_{OR} = \left[ \exp(L), \exp(U) \right] $$

where \(L\) and \(U\) are the lower and upper confidence limits for the coefficient.

Predicted Values

Regression coefficients are often easier to communicate clinically when converted into predicted outcomes.

For logistic regression:

$$ \hat{p} = \frac{\exp(\hat{\eta})} {1+\exp(\hat{\eta})} $$

For a log-link model:

$$ \hat{\mu} = \exp(\hat{\eta}) $$

Predicted probabilities, event rates, or mean outcomes can then be reported for clinically meaningful patient profiles.

Marginal vs. Conditional Interpretation

GLM predictions can be presented in different ways.

A conditional prediction corresponds to a specific covariate pattern.

For example:

  • 65-year-old patient
  • Moderate baseline disease severity
  • Active treatment

A marginal prediction averages predictions over a population or covariate distribution.

Marginal summaries can sometimes be easier to interpret as population-level treatment effects.

Clinical reporting point: When communicating GLM results, clearly state whether a reported effect is conditional on covariates or averaged over a population.

Model Diagnostics

A fitted GLM should not be accepted simply because the software successfully produced coefficient estimates.

Model diagnostics should assess whether the assumptions and model structure are reasonable.

Useful diagnostic considerations include:

  • Residual behavior
  • Influential observations
  • Overdispersion
  • Goodness of fit
  • Linearity of continuous predictors on the link scale
  • Potential interactions
  • Multicollinearity
  • Separation in logistic regression
  • Excess zeros in count data

Linearity on the Link Scale

One of the most frequently misunderstood GLM assumptions is linearity.

A logistic regression does not necessarily assume that:

$$ p=\beta_0+\beta_1X $$

Instead, it assumes linearity of the predictor on the logit scale:

$$ \operatorname{logit}(p) = \beta_0+\beta_1X $$

Similarly, a Poisson model with a log link assumes:

$$ \log(\mu) = \beta_0+\beta_1X $$

Therefore, nonlinear relationships may need transformations, splines, or other appropriate modeling approaches.

Continuous Covariates and Splines

Suppose age has a nonlinear relationship with the probability of treatment response.

Rather than assuming:

$$ \operatorname{logit}(p)=\beta_0+\beta_1\operatorname{Age} $$

a flexible function \(f(\operatorname{Age})\) can be used:

$$ \operatorname{logit}(p) = \beta_0+ f(\operatorname{Age}) $$

Restricted cubic splines and other spline methods are commonly used for this purpose.

Overdispersion Diagnostics

For a Poisson model, substantial overdispersion can indicate that the variance assumption is inappropriate.

One rough diagnostic is the ratio:

$$ \frac{\text{Residual Deviance}} {\text{Residual Degrees of Freedom}} $$

A value substantially greater than 1 can indicate overdispersion, although this should not be treated as an automatic decision rule.

Other approaches include examining Pearson residuals and comparing Poisson and negative binomial models.

Separation in Logistic Regression

Logistic regression can encounter a problem called complete separation.

Suppose every patient receiving treatment responds while every patient receiving placebo fails.

The model may attempt to send the treatment coefficient toward infinity.

This can result in:

  • Extremely large coefficients
  • Huge standard errors
  • Failure of ordinary maximum likelihood estimation
  • Unstable odds ratios

Possible approaches include penalized likelihood methods or other prespecified methods designed for sparse binary data.

Do not interpret an enormous odds ratio blindly. An extremely large estimate can reflect sparse data or separation rather than a precisely estimated enormous treatment effect.

Zero-Inflated and Hurdle Models

Some clinical count datasets contain substantially more zeroes than a standard Poisson or negative binomial model can accommodate.

For example, a trial might record the number of disease exacerbations, and many patients may have zero exacerbations.

A zero-inflated model can conceptually separate:

  • A process generating structural zeroes
  • A count process generating zero and positive counts

A simplified zero-inflated model can be written as:

$$ P(Y=0) = \pi+(1-\pi)P_{\text{count}}(0) $$

while for positive counts:

$$ P(Y=y) = (1-\pi)P_{\text{count}}(y), \qquad y>0 $$

These models are related to GLMs but introduce a more complex mixture structure.

GLMs vs. Generalized Estimating Equations

A standard GLM generally assumes independent observations conditional on the model.

Clinical trials can violate this assumption when patients contribute repeated measurements.

For correlated outcomes, approaches such as:

  • Generalized estimating equations (GEE)
  • Generalized linear mixed models (GLMMs)
  • Other longitudinal models

may be more appropriate.

Important distinction: GLM, GEE, and GLMM are related but are not interchangeable. A standard GLM is usually appropriate for independent observations, whereas repeated or clustered data require explicit consideration of within-subject or within-cluster correlation.

GLM vs. GLMM

Feature GLM GLMM
Outcome distribution Can be non-normal Can be non-normal
Fixed effects Yes Yes
Random effects No Yes
Repeated measurements Usually not directly handled Yes
Cluster correlation Not modeled directly Can be modeled

Software Implementation in R

The base R function glm() provides a general interface for fitting many standard GLMs.

For logistic regression:

fit_logistic <- glm(
  response ~ treatment + age + baseline_severity,
  family = binomial(link = "logit"),
  data = clinical_data
)

summary(fit_logistic)

The coefficient estimates are on the log-odds scale.

Odds ratios can be obtained by exponentiating the coefficients:

exp(coef(fit_logistic))

R: Poisson Regression

fit_poisson <- glm(
  exacerbations ~ treatment + age + baseline_severity,
  family = poisson(link = "log"),
  data = clinical_data
)

summary(fit_poisson)

The exponentiated treatment coefficient is interpreted as a multiplicative effect on the expected count or rate, depending on whether exposure time is incorporated.

R: Poisson Regression with an Offset

Suppose each patient has a different follow-up time.

fit_poisson_rate <- glm(
  exacerbations ~ treatment + age + baseline_severity +
    offset(log(followup_time)),
  family = poisson(link = "log"),
  data = clinical_data
)

The offset is constrained to have coefficient 1 and adjusts the model for different exposure durations.

R: Negative Binomial Regression

Negative binomial regression is not part of base R's glm() family options in the same way as Poisson regression.

A common implementation uses the MASS package:

library(MASS)

fit_nb <- glm.nb(
  exacerbations ~ treatment + age + baseline_severity,
  data = clinical_data
)

summary(fit_nb)

exp(coef(fit_nb))

The exponentiated treatment coefficient is interpreted as a rate or mean ratio according to the model and exposure specification.

R: Gamma GLM

fit_gamma <- glm(
  hospital_days ~ treatment + age + baseline_severity,
  family = Gamma(link = "log"),
  data = clinical_data
)

summary(fit_gamma)

exp(coef(fit_gamma))

The exponentiated coefficient describes a multiplicative change in the conditional mean.

R: Predicted Probabilities

For logistic regression, predicted probabilities can be generated with type = "response":

predicted_probability <- predict(
  fit_logistic,
  newdata = new_patients,
  type = "response"
)

predicted_probability

This converts predictions from the linear predictor scale to the probability scale.

R: Predicted Means for Count Models

The same principle applies to log-link models:

predicted_rate <- predict(
  fit_nb,
  newdata = new_patients,
  type = "response"
)

predicted_rate

The result is on the expected-count or rate scale implied by the model.

SAS: Logistic Regression

In SAS, a standard logistic GLM can be fitted using PROC LOGISTIC:

proc logistic data=clinical_data;
    class treatment(ref='Placebo') / param=ref;

    model response(event='1') =
        treatment
        age
        baseline_severity;

    oddsratio treatment;
run;

The ODDSRATIO statement requests an odds-ratio interpretation for the treatment effect.

SAS: Poisson Regression

proc genmod data=clinical_data;
    class treatment(ref='Placebo');

    model exacerbations =
        treatment
        age
        baseline_severity
        / dist=poisson
          link=log
          type3;

    estimate 'Treatment Rate Ratio'
        treatment 1 -1
        / exp;
run;

If follow-up differs, an offset can be incorporated:

proc genmod data=clinical_data;
    class treatment(ref='Placebo');

    model exacerbations =
        treatment
        age
        baseline_severity
        / dist=poisson
          link=log
          offset=log_followup;
run;

SAS: Negative Binomial Regression

proc genmod data=clinical_data;
    class treatment(ref='Placebo');

    model exacerbations =
        treatment
        age
        baseline_severity
        / dist=negbin
          link=log
          type3;

    estimate 'Treatment Rate Ratio'
        treatment 1 -1
        / exp;
run;

The negative binomial distribution is useful when the count data exhibit overdispersion relative to the Poisson assumption.

Choosing the Distribution

The distribution should be selected based on the scientific nature and observed behavior of the endpoint.

Clinical Endpoint Potential Model Primary Reason
Responder / non-responder Logistic regression Binary outcome
Number of events Poisson regression Count outcome
Overdispersed number of events Negative binomial regression Variance exceeds Poisson expectation
Positive skewed continuous outcome Gamma GLM Positive continuous distribution
Approximately normal continuous outcome Linear regression Normal-error framework

A Practical Model-Selection Workflow

1
Define the clinical endpoint precisely.
2
Determine whether the endpoint is binary, count, continuous, proportion, or another type.
3
Consider the scientific sampling mechanism and probability distribution.
4
Select a plausible link function.
5
Specify clinically important covariates before examining treatment results.
6
Fit the prespecified model.
7
Assess diagnostics and model assumptions.
8
Report effects on an interpretable clinical scale.

GLM Interpretation: A Three-Step Rule

When interpreting a GLM coefficient, use the following sequence.

Step 1: Identify the link

Ask whether the model uses:

  • Identity
  • Logit
  • Log
  • Another link

Step 2: Interpret the coefficient on the link scale

For example, a logistic coefficient represents a change in log odds.

Step 3: Transform to the clinical scale

For a logit model:

$$ \exp(\beta)=\text{odds ratio} $$

For a log-link model:

$$ \exp(\beta)=\text{multiplicative effect} $$

This simple procedure prevents many common interpretation errors.

Common GLM Mistakes

  1. Using ordinary linear regression for a binary outcome. The predictions can fall outside 0 and 1 and the error structure is generally inappropriate.
  2. Using Poisson regression without checking dispersion. Substantial overdispersion can make standard Poisson inference inappropriate.
  3. Confusing odds ratios with risk ratios. They are different effect measures.
  4. Interpreting log-link coefficients as additive effects. Exponentiation is generally required for a multiplicative interpretation.
  5. Ignoring unequal exposure time in count models. An offset may be needed when patients have different observation times.
  6. Assuming linearity on the raw outcome scale. For a GLM, linearity generally concerns the link-transformed mean.
  7. Ignoring separation in logistic regression. Sparse binary data can produce unstable maximum likelihood estimates.
  8. Choosing a distribution only from convenience. The probability model should reflect the clinical endpoint and data-generating mechanism.
  9. Reporting only the coefficient. Clinical readers often need odds ratios, rate ratios, predicted probabilities, or predicted means.
  10. Ignoring correlation in repeated observations. A standard GLM assumes conditional independence and may not be appropriate for longitudinal or clustered data.

GLMs in Clinical Trial Reporting

A statistical report should provide enough information for the model to be understood and reproduced.

At minimum, report:

  • Endpoint definition
  • Distribution used
  • Link function
  • Covariates
  • Reference categories
  • Treatment coding
  • Interaction terms, if applicable
  • Offset, if applicable
  • Estimated effect
  • Confidence interval
  • Statistical test or p-value, where appropriate
  • Model diagnostics or fit considerations

Example Reporting Language: Logistic Regression

A concise clinical report might state:

Example: A logistic regression model was used to estimate the association between treatment and clinical response, adjusting for baseline disease severity and age. Treatment effects are presented as odds ratios with corresponding 95% confidence intervals.

Example Reporting Language: Negative Binomial Regression

Example: A negative binomial regression model was used to analyze the number of exacerbations, with treatment and prespecified baseline covariates included as predictors. Follow-up duration was incorporated through an offset. Treatment effects are reported as rate ratios with 95% confidence intervals.

GLMs and Multiplicity

Using a GLM does not automatically solve multiplicity problems.

A clinical trial may evaluate:

  • Multiple endpoints
  • Multiple treatment groups
  • Multiple subgroup analyses
  • Multiple time points
  • Multiple contrasts

If multiple inferential comparisons are planned, the statistical analysis strategy should address multiplicity separately.

Key distinction: The GLM specifies how the outcome is modeled. Multiplicity procedures address how multiple statistical questions are controlled. These are different parts of the statistical analysis.

GLMs and Missing Data

A GLM does not automatically determine how missing observations should be handled.

The appropriate strategy depends on:

  • The endpoint
  • The reason observations are missing
  • The timing of missingness
  • The estimand
  • The analysis population
  • The assumptions made about the missing-data mechanism

Possible approaches may include:

  • Likelihood-based analysis
  • Multiple imputation
  • Inverse probability weighting
  • Sensitivity analyses
  • Prespecified missing-data rules

Missing-data handling should therefore be considered separately from the choice of GLM family.

GLMs and the Estimand Framework

In modern clinical trials, model choice should be connected to the estimand.

Before choosing the model, investigators should clarify:

  • What treatment effect is being estimated?
  • Which population is relevant?
  • How are intercurrent events handled?
  • What summary measure will represent the treatment effect?

The GLM is then selected to estimate the intended treatment effect appropriately.

Important: A statistically sophisticated GLM cannot rescue an analysis whose estimand or endpoint definition is unclear.

When a GLM Is Not Enough

GLMs are powerful, but they are not a universal solution.

Alternative approaches may be needed for:

  • Repeated continuous measurements
  • Repeated binary outcomes
  • Hierarchical data
  • Time-to-event endpoints
  • Competing risks
  • Multi-state processes
  • Complex longitudinal count outcomes
  • Highly zero-inflated data
  • Joint modeling problems

For example, a time-to-event endpoint is usually modeled using survival analysis rather than a standard GLM.

The GLM Decision Tree

Question Possible Direction
Is the endpoint binary? Consider binomial/logistic regression
Is the endpoint a count? Consider Poisson or negative binomial regression
Is the outcome positive and continuous? Consider Gamma or another suitable model
Is the outcome approximately normal? Consider linear regression
Are observations repeated within subjects? Consider GEE or GLMM
Are observations clustered? Consider a model accounting for clustering
Is the endpoint time-to-event? Consider survival methods
Are there excess zero counts? Consider zero-inflated or hurdle approaches

The Big Picture

The most useful way to understand GLMs is not as a collection of unrelated regression procedures.

Instead, think of them as a common framework:

A
Choose the outcome distribution. What kind of random variable is being modeled?
B
Choose the link. How should the expected outcome be transformed?
C
Specify the linear predictor. Which clinical variables explain differences in the outcome?
D
Estimate the parameters. Usually by maximum likelihood.
E
Check the model. Assess fit, dispersion, functional form, influential observations, and other relevant assumptions.
F
Translate the result. Report the effect on a clinically interpretable scale.

Summary Table of Major GLMs

Model Outcome Distribution Link Typical Effect
Linear regression Continuous Normal Identity Mean difference
Logistic regression Binary Binomial Logit Odds ratio
Poisson regression Count Poisson Log Rate ratio
Negative binomial regression Overdispersed count Negative binomial Log Rate ratio
Gamma regression Positive continuous Gamma Log or inverse Mean ratio

A Compact Mathematical Summary

The general GLM can be summarized by:

$$ g(\mu_i)=\eta_i $$

with:

$$ \eta_i = \beta_0+ \beta_1X_{i1} +\cdots+ \beta_pX_{ip} $$

and:

$$ \mu_i = g^{-1}(\eta_i) $$

The probability distribution specifies how \(Y_i\) varies around \(\mu_i\).

That gives the three essential pieces:

$$ \boxed{ \text{Distribution} + \text{Link} + \text{Linear Predictor} } $$

Common Clinical Examples

Clinical Question Potential GLM
Does treatment increase the probability of remission? Logistic regression
Does treatment reduce the number of exacerbations? Negative binomial regression
Does treatment affect the rate of recurrent events? Poisson or negative binomial model with exposure adjustment
Does treatment affect a positive, right-skewed cost outcome? Gamma GLM with log link
Does treatment affect a normally distributed biomarker? Linear regression

What to Remember for Interviews and Exams

If you are preparing for a biostatistics interview or examination, remember these core points:

  • A GLM has a random component, systematic component, and link function.
  • The linear predictor is typically \(\eta=X\beta\).
  • The link connects the mean to the linear predictor.
  • Logistic regression is a binomial GLM with a logit link.
  • Poisson regression is a Poisson GLM with a log link.
  • Negative binomial regression is commonly used for overdispersed counts.
  • Exponentiating logistic coefficients gives odds ratios.
  • Exponentiating log-link coefficients gives multiplicative effects such as rate ratios.
  • Poisson regression assumes mean equal to variance.
  • GLM linearity generally concerns the link-transformed mean.
  • Standard GLMs do not automatically handle repeated-measures correlation.
  • Model selection should be driven by the clinical endpoint and data structure.

Final Practical Workflow

1
Define the clinical estimand and endpoint.
2
Determine the outcome type: continuous, binary, count, or positive continuous.
3
Select a scientifically appropriate probability distribution.
4
Select an appropriate link function.
5
Specify treatment and clinically important covariates.
6
Determine whether an offset, interaction, nonlinear term, or other model component is required.
7
Fit the GLM using maximum likelihood.
8
Evaluate model diagnostics and goodness of fit.
9
Transform coefficients into clinically meaningful measures.
10
Report estimates, confidence intervals, assumptions, and analysis methods clearly.

The Most Important Concept

The most important idea behind generalized linear models is that different types of clinical outcomes require different probability models, but their regression structures can still be expressed within one unified framework.

A GLM asks three fundamental questions:

  1. What distribution describes the outcome?
  2. What link function connects its expected value to the predictors?
  3. What linear predictor describes the relationship between covariates and the outcome?

For a binary endpoint, this leads naturally to logistic regression.

For a count endpoint, it may lead to Poisson or negative binomial regression.

For a positive continuous endpoint, a Gamma GLM may be appropriate.

For a normally distributed continuous endpoint, ordinary linear regression is itself a special case of the broader framework.

Bottom line: Generalized linear models provide a unified framework for regression analysis when clinical outcomes do not satisfy the assumptions of ordinary linear regression. The key components are the outcome distribution, link function, and linear predictor. Logistic regression handles binary outcomes, Poisson regression handles counts under an equidispersion assumption, negative binomial regression handles overdispersed counts, and other GLMs extend the framework to additional outcome types. The correct model depends on the endpoint, variance structure, exposure, correlation structure, and scientific question. Once the model is selected, coefficients should be transformed and reported on a scale that is meaningful for clinical interpretation.

References

McCullagh, P. & Nelder, J.A. (1989). Generalized Linear Models. 2nd ed. Chapman & Hall.
Dobson, A.J. & Barnett, A.G. (2018). An Introduction to Generalized Linear Models. 4th ed. CRC Press.
Agresti, A. (2015). Foundations of Linear and Generalized Linear Models. Wiley.
Hosmer, D.W., Lemeshow, S. & Sturdivant, R.X. (2013). Applied Logistic Regression. 3rd ed. Wiley.
Hilbe, J.M. (2011). Negative Binomial Regression. 2nd ed. Cambridge University Press.
Hardin, J.W. & Hilbe, J.M. (2018). Generalized Linear Models and Extensions. 4th ed. Stata Press.

Clinical Trials

See these methods in real clinical trials

See the method applied to published trial results, with the estimates, confidence intervals and interpretation explained.

FLAME
Independent statistical analysis of the FLAME phase 3 trial of QVA149 versus LABA/ICS in COPD, including exacerbation rates, time-to-event analyses, non-inferiority methodology,…
Phase 3 · n = 3,362
CAPRISA 008
Independent statistical analysis of CAPRISA 008, a randomized phase 2/3 trial evaluating 1% tenofovir gel provision through family planning services for HIV…
Phase 2/3 · n = 372