Tutorials › Generalized Linear Mixed Models (GLMM) › The Conditional Mean and Linear Predictor

From GLM to GLMM · Tutorial 1 of 698

The Conditional Mean and Linear Predictor

You will learn to define the linear predictor, connect it to the conditional response mean through a link, and interpret the distinction using binary-outcome examples.

Beginner 11 min read

What You'll Learn

  • Define a conditional response mean and a GLM linear predictor.
  • Explain how a link function relates the predictor to the mean.
  • Calculate conditional probabilities from a logistic linear predictor.
  • Interpret coefficients on the predictor scale without confusing them with mean-scale changes.
  • Recognize mean-model assumptions, diagnostics, and common prediction failures.

Why Separate the Predictor From the Mean?

A generalized linear model (GLM) separates two quantities that can be easy to confuse: a linear predictor, built from covariates and coefficients, and the conditional mean of the response. The predictor is a convenient scale on which to combine covariate effects. The mean is the quantity that describes the response on its original scale. A link function connects the two.

This distinction is especially important for a binary outcome. A linear predictor can be any real number, but the conditional mean of a binary response must be between 0 and 1. The predictor therefore cannot generally be read as a probability. Instead, it is transformed to obtain the probability. The introductory material on GLM (C27) provides the broader GLM context; here the focus is the relationship between these two quantities.

Definition: For observation \(i\), let \(Y_i\) be a response and let \(x_i\) be its vector of observed covariates, including an intercept component when the model has an intercept. The conditional response mean is \(\mu_i=E(Y_i\mid x_i)\). A GLM linear predictor is \(\eta_i=x_i^{T}\beta\), where \(\beta\) is a vector of coefficients. A link function \(g\) specifies the mean model by \(g(\mu_i)=\eta_i\). When \(g\) is one-to-one over the relevant mean range, this is equivalently \(\mu_i=g^{-1}(\eta_i)\).

“Linear” refers to the predictor’s form in the coefficients: it is a sum of covariate values multiplied by coefficients. Covariates may themselves be transformed or coded into indicator variables, so the predictor need not be a straight-line function of every original measurement. The vector notation is shorthand for a sum such as \(\eta_i=\beta_0+\beta_1x_{i1}+\cdots+\beta_px_{ip}\).

The conditional mean is defined given the covariates. It is not the observed value \(Y_i\): for a binary response, the observation is either 0 or 1, while the conditional mean is the probability of observing 1. A mean model states how that expected response varies with covariates; it does not determine each individual outcome with certainty.

From Predictor to Conditional Mean

The link \(g\) puts the mean on the predictor scale. For a specified link, first calculate \(\eta_i=x_i^T\beta\), then apply the inverse link to obtain \(\mu_i\). The exact relationship depends on the chosen link. For example, with the identity link \(g(\mu)=\mu\), the mean equals the predictor. With a nonlinear link, the mean is a transformed version of it. These are different model specifications, not two names for the same quantity.

For a binary response coded \(Y_i=1\) when an event occurs and \(Y_i=0\) otherwise, the conditional mean has a particularly direct interpretation:

$$ \mu_i=E(Y_i\mid x_i)=P(Y_i=1\mid x_i). $$

The logistic link is a common choice for a binary response. It relates the event probability to the predictor by the logit, the logarithm of the odds. Inverting that relationship gives a probability between 0 and 1 for every finite predictor value.

$$ \eta_i=\log\!\left(\frac{\mu_i}{1-\mu_i}\right), \qquad \mu_i=\frac{e^{\eta_i}}{1+e^{\eta_i}}=\frac{1}{1+e^{-\eta_i}}. $$

Worked Example: Calculating a Binary Conditional Mean

Suppose a hypothetical model predicts whether a patient experiences a binary event, with \(Y_i=1\) denoting that event. Let \(x_i\) be the number of prior visits, and suppose the conditional event probability follows a logistic mean model with \(\beta_0=-1.2\) and \(\beta_1=0.08\). This calculation assumes the stated logistic relationship for the conditional mean; it does not require the event to occur for every patient with the same covariate value.

For a patient with 10 prior visits, the linear predictor is \(\eta_i=-1.2+0.08(10)=-1.2+0.8=-0.4\). The predictor is \(-0.4\) on the log-odds scale, not a probability of \(-0.4\).

Transforming to the response scale gives \(\mu_i=1/(1+e^{-(-0.4)})=1/(1+e^{0.4})\). Since \(e^{0.4}\approx1.4918\), the result is \(\mu_i\approx1/2.4918\approx0.4013\). Thus, under this hypothetical model, the conditional probability of the event for a patient with 10 prior visits is about 0.4013, or 40.13%.

For 15 prior visits, \(\eta_i=-1.2+0.08(15)=0\), so \(\mu_i=1/(1+e^0)=0.5000\). The difference in predicted probabilities between these two covariate values is \(0.5000-0.4013=0.0987\), or 9.87 percentage points. It is not equal to the coefficient 0.08: that coefficient is a change in log odds per additional prior visit.

Why the Binary Mean Is a Probability

The probability interpretation follows directly from the definition of expectation for a binary variable. Conditional on \(x_i\), let \(p_i=P(Y_i=1\mid x_i)\); then \(P(Y_i=0\mid x_i)=1-p_i\). Multiplying each possible value by its probability gives the conditional expectation:

$$ E(Y_i\mid x_i) =0\cdot P(Y_i=0\mid x_i)+1\cdot P(Y_i=1\mid x_i) =p_i. $$

Therefore \(\mu_i=p_i\). Under the logistic model, the specified relationship is \(\log\{\mu_i/(1-\mu_i)\}=x_i^T\beta\). Exponentiating both sides yields \(\mu_i/(1-\mu_i)=e^{\eta_i}\). Multiplying by \(1-\mu_i\) and collecting the terms involving \(\mu_i\) gives \(\mu_i(1+e^{\eta_i})=e^{\eta_i}\), hence \(\mu_i=e^{\eta_i}/(1+e^{\eta_i})\). This shows both why the predictor is on a different scale and how it determines the conditional mean.

For a mean model to be coherent, its predicted mean must lie in the allowable range for the response. The logistic inverse satisfies \(0<\mu_i<1\) for every finite \(\eta_i\), as required for a binary event probability. This range property does not guarantee that the selected covariates, coefficients, or overall model are scientifically adequate; it only ensures that the fitted mean is on a possible probability scale.

Worked Example: Interpreting a Predictor Coefficient

Consider a hypothetical binary outcome modeled by \(\eta_i=-2+0.5x_i\), where \(x_i\) is a numerical exposure measured in units. Assume the conditional event probability is related to this predictor by the logistic link. Compare the predicted probabilities at \(x_i=3\) and \(x_i=5\).

At \(x_i=3\), \(\eta_i=-2+0.5(3)=-0.5\). Thus \(\mu_i=1/(1+e^{0.5})\approx1/(1+1.6487)\approx0.3775\). At \(x_i=5\), \(\eta_i=-2+0.5(5)=0.5\), and \(\mu_i=1/(1+e^{-0.5})\approx1/(1+0.6065)\approx0.6225\). The model’s predicted probability rises by about \(0.6225-0.3775=0.2450\), or 24.50 percentage points, over this two-unit increase.

The coefficient \(0.5\) is not that probability difference. It means that a one-unit increase in \(x_i\) increases the linear predictor by 0.5. Because the predictor is the log odds under this link, the corresponding odds are multiplied by \(e^{0.5}\approx1.649\) for each one-unit increase, holding other covariates fixed. The probability change depends on the starting value of the predictor, so it is not constant across the covariate range.

Coding Covariates and Interpreting the Intercept

The linear predictor also depends on how covariates are represented. For a two-group predictor, one common coding uses \(x_i=0\) for a reference group and \(x_i=1\) for a comparison group. In \(\eta_i=\beta_0+\beta_1x_i\), the reference group’s predictor is \(\beta_0\), and the comparison group’s predictor is \(\beta_0+\beta_1\). Under a logistic link, these quantities are group-specific log odds, while the group-specific conditional means are their logistic transformations.

Worked Example: A Binary Covariate and Group Probabilities

Suppose, hypothetically, that an outcome is coded 1 for an event and that group membership is represented by \(x_i=0\) for the reference group and \(x_i=1\) for the comparison group. Let the logistic mean model be \(\eta_i=-1+0.6x_i\). The assumed link makes the conditional mean an event probability.

For the reference group, \(\eta_i=-1+0.6(0)=-1\), so \(\mu_i=1/(1+e^1)\approx1/3.7183\approx0.2689\). For the comparison group, \(\eta_i=-1+0.6(1)=-0.4\), so \(\mu_i=1/(1+e^{0.4})\approx0.4013\). The model-based difference in conditional probabilities is \(0.4013-0.2689=0.1324\), or 13.24 percentage points.

The coefficient \(0.6\) is the difference in log odds between the comparison and reference groups. The corresponding odds ratio is \(e^{0.6}\approx1.822\). It is not a difference of 0.6 in probability; the probability difference here is about 0.1324. The intercept \(-1\) is the reference group’s log odds under this coding, not its event probability.

Assumptions, Diagnostics, and Alternatives

The equations above concern a conditional mean model. For their interpretation, the response and covariates must be defined consistently, the coefficient and link specification must be stated, and the conditional mean must be in the response’s allowable range. In the binary examples, the response is coded 0 or 1 and the logistic inverse supplies a valid probability. The arithmetic does not require independence across observations. However, valid estimation and uncertainty calculations need assumptions about the response distribution and dependence appropriate to the data; a mean equation alone does not settle those issues.

Useful checks focus on whether the specified mean relationship is plausible. For a binary outcome, examine observed event proportions across covariate ranges and compare them with model-based predicted probabilities, accounting for the fact that small groups can have noisy proportions. Look for systematic under- or over-prediction, an implausible shape across a continuous covariate, and predictions that cluster near 0 or 1 where the data do not support such certainty. A predictor can be calculated correctly while the model’s mean structure is still inadequate.

  • Confusing scales. A predictor outside the interval from 0 to 1 is not automatically an error for a logistic model; it is on the log-odds scale. Apply the inverse link before interpreting a probability.
  • Reading a coefficient as a probability change. Under the logistic link, a slope is a change in log odds per covariate unit. The associated probability change depends on the predictor’s starting value.
  • Extrapolating carelessly. The logistic inverse always returns a mathematically valid probability, but predictions far beyond the observed covariate range may be unreliable because the assumed relationship is being extended without data support.
  • Using a mean equation as a complete data model. Specifying \(E(Y_i\mid x_i)\) does not by itself specify the full conditional distribution or the dependence among observations.

A direct linear model for a binary response is a possible alternative mean specification, but it can predict values below 0 or above 1 and imposes a constant probability change per covariate unit. The logistic mean model avoids predictions outside the probability range and instead has covariate effects that are linear on the log-odds scale. No link makes a model automatically correct: choice depends on the response scale, the intended interpretation, and how well the mean pattern describes the data.

The central distinction is practical as well as notational. The linear predictor is assembled from covariates and coefficients on a chosen scale; the link determines how that scale maps to the conditional mean. In a binary logistic model, \(\eta_i\) is a log odds and \(\mu_i\) is an event probability. Keeping those roles separate prevents invalid interpretations and helps identify which part of a model’s specification or prediction needs scrutiny.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. In one sentence, distinguish \(\eta_i\) from \(\mu_i\) in a GLM.
  2. A binary-outcome model has \(\eta_i=0.7\) for an observation and uses the logistic link. Calculate its conditional event probability to four decimal places.
  3. Under a logistic link, what does a coefficient of \(-0.2\) mean for a one-unit increase in a numerical covariate, holding the other covariates fixed?
  4. Explain why the conditional mean of a response coded 0 or 1 is an event probability.
  5. Give one limitation of a direct linear mean model for a binary response.

Solutions. (1) \(\eta_i=x_i^T\beta\) is the linear predictor on the link scale, whereas \(\mu_i=E(Y_i\mid x_i)\) is the conditional mean on the response scale. (2) \(\mu_i=1/(1+e^{-0.7})\approx1/(1+0.4966)\approx0.6682\), so the predicted event probability is about 66.82%. (3) The predictor, and thus the log odds, decreases by 0.2; the odds are multiplied by \(e^{-0.2}\approx0.8187\). This is not a fixed probability decrease of 0.2. (4) If the event probability is \(p_i\), then \(E(Y_i\mid x_i)=0(1-p_i)+1(p_i)=p_i\). (5) A direct linear mean model can predict probabilities below 0 or above 1; it also imposes a constant probability change for each one-unit covariate increase.

Clinical Biostats