Tutorials › Exam PA - Predictive Analytics › Constraining Predicted Means With Link Choice

Exam PA · GLM Families and Model Construction · Tutorial 318 of 966

Constraining Predicted Means With Link Choice

See how the inverse link determines the range of a GLM’s fitted means, and check predictions against the response’s valid range.

Intermediate 12 min read

What You'll Learn

  • Distinguish the linear predictor from the fitted mean on the response scale
  • Identify the ranges guaranteed by logit, probit, complementary log-log, log, identity, and inverse links
  • Check whether a predicted mean is valid for a binary, count, positive, or unrestricted-real response
  • Recognize when identity and inverse links can produce invalid predictions
  • Separate a link’s mathematical range from the response family’s assumptions
  • Avoid interpreting an invalid fitted mean as a valid probability or expected claim amount

Why the Link Function Constrains Predictions

A generalized linear model forms a linear predictor from covariates, but its predictions are usually reported as fitted means on the response scale. The link function is the bridge between these two scales. Its choice matters because a linear predictor can take any real value, whereas a response mean may have to be a probability, a nonnegative count mean, or a strictly positive amount.

For example, a binary outcome has a mean between 0 and 1. A model that predicts a probability of \(-0.2\) or \(1.3\) has produced a number that cannot describe the probability of the event. A positive-amount model has a related constraint: a negative predicted mean is not a possible expected claim amount. The key diagnostic is to calculate the fitted mean using the inverse link and then check that value against the response’s valid range.

Definition: In a generalized linear model, the conditional mean is \(\mu_i=E[Y_i\mid x_i]\), and the linear predictor is \(\eta_i=x_i^\mathsf{T}\beta\). The link function \(g\) relates them by \(g(\mu_i)=\eta_i\). When the inverse link \(g^{-1}\) is defined at \(\eta_i\), the fitted mean is \(\hat{\mu}_i=g^{-1}(\eta_i)\). A link guarantees a valid fitted mean only when its inverse maps every possible linear predictor into the required range.

The linear predictor \(\eta_i\) is not itself generally a prediction of the response mean. It can be negative, positive, or zero. The inverse link transforms it to the response scale. Thus, the same value of \(\eta_i\) can produce a very different fitted mean under two different links.

A link’s range must be considered together with the response family. Bernoulli means must lie in \([0,1]\); Poisson means must be nonnegative; Gamma means must be strictly positive; and a Gaussian mean is mathematically unrestricted on the real line. These are constraints on the conditional mean, not necessarily on every possible observed response. For instance, a Poisson response is a nonnegative integer, while its mean need not be an integer.

Common Links and Their Mean Ranges

The table summarizes several standard links. Here \(\eta\) can be any real number unless the link or its inverse imposes an additional domain restriction.

Link \(g(\mu)\)Inverse link \(\mu=g^{-1}(\eta)\)Range of fitted meansImplication
Logit: \(\log\{\mu/(1-\mu)\}\)\(1/(1+e^{-\eta})\)\((0,1)\)Strictly between 0 and 1 for every finite \(\eta\)
Probit: \(\Phi^{-1}(\mu)\)\(\Phi(\eta)\)\((0,1)\)Strictly between 0 and 1 for every finite \(\eta\)
Complementary log-log: \(\log\{-\log(1-\mu)\}\)\(1-\exp\{-\exp(\eta)\}\)\((0,1)\)Strictly between 0 and 1 for every finite \(\eta\)
Log: \(\log(\mu)\)\(e^\eta\)\((0,\infty)\)Always positive; not bounded above by 1
Identity: \(\mu\)\(\eta\)\(\mathbb{R}\)Unrestricted, so it can violate probability or positivity constraints
Inverse: \(1/\mu\)\(1/\eta\)Positive means only when \(\eta>0\)Undefined at zero and negative when \(\eta<0\)

The logit, probit, and complementary log-log links each guarantee a probability strictly inside the interval \((0,1)\) for every finite linear predictor. They do not produce exactly 0 or 1 at any finite value of \(\eta\), although predictions can be extremely close to either endpoint. The log link guarantees a positive mean, but it does not guarantee a probability: for example, \(e^2>1\). The identity link allows every real-valued mean, so it is suitable for an unrestricted-real mean but can violate other response constraints.

The inverse link requires particular care. For a positive mean \(\mu\), the inverse link \(g(\mu)=1/\mu\) yields a positive linear predictor. Therefore, its inverse is valid for a fitted mean only when \(\eta>0\). A linear predictor is not automatically positive simply because the observed responses are positive.

Why the Logit Link Guarantees a Valid Probability

The logit link is defined for a probability \(p\) strictly between 0 and 1:

$$ \operatorname{logit}(p)=\log\left(\frac{p}{1-p}\right)=\eta. $$

Exponentiating both sides gives \(e^\eta=p/(1-p)\). Rearranging, \(e^\eta(1-p)=p\), so \(e^\eta=p(1+e^\eta)\) and

$$ p=\frac{e^\eta}{1+e^\eta}=\frac{1}{1+e^{-\eta}}. $$

For every finite real \(\eta\), \(e^\eta>0\). The denominator \(1+e^\eta\) is larger than the numerator \(e^\eta\), so \(0<e^\eta/(1+e^\eta)<1\). This proves that the inverse logit always gives a valid probability for a finite predictor. This argument concerns the mathematical range of the inverse link; it does not prove that the fitted model is otherwise appropriate.

Worked Example: Checking a Binary-Outcome Prediction

A hypothetical insurer models whether a policyholder files a roadside-assistance claim during a year. Let \(Y_i\mid x_i\sim\operatorname{Bernoulli}(p_i)\), with \(p_i=E[Y_i\mid x_i]\). Suppose the fitted linear predictor is \(\eta_i=-1+0.3x_i\), where \(x_i\) is an assistance-use score. At \(x_i=10\), calculate and assess the prediction using (a) an identity link and (b) a logit link.

Method and assumptions. The response is Bernoulli, so its conditional mean must be a probability in \([0,1]\). The Bernoulli distribution has parameter \(p_i\). The predictor is evaluated at \(x_i=10\), and the same predictor value is used for each link.

First calculate the linear predictor:

$$ \eta_i=-1+0.3(10)=-1+3=2. $$

(a) Identity link. For \(g(p)=p\), the inverse link is \(p=\eta\). Therefore, \(\hat p_i=2\). Since \(2>1\), this is not a valid probability and cannot be a Bernoulli mean.

(b) Logit link. The inverse link gives

$$ \hat p_i=\frac{1}{1+e^{-2}}. $$

Using \(e^{-2}\approx0.135335\), the denominator is \(1.135335\), so \(\hat p_i\approx1/1.135335\approx0.880797\). To four decimal places, the fitted probability is \(0.8808\), which is within \([0,1]\). The prediction is valid as a probability. The identity-link result of \(2\) is the common mistake this comparison avoids: the linear predictor can be used directly as a mean only under the identity link, and that does not make it a valid probability.

Check. The logit result is greater than 0 and less than 1, as the inverse-logit range requires. The identity-link result exceeds 1, so it fails the Bernoulli mean constraint.

Positive Means and the Risk of an Unsuitable Link

For a Poisson response, the conditional mean must be nonnegative. For a Gamma response, the conditional mean must be strictly positive. The log link maps every finite real predictor to a positive mean, so it respects both constraints. For Poisson outcomes, the log link does not produce a mean of exactly zero at any finite predictor, although it can produce a value close to zero. The identity link does not guarantee nonnegative or positive means. The inverse link can be useful for positive means only if its predictor is positive.

Worked Example: Detecting a Negative Poisson Mean

A hypothetical maintenance team models the number of urgent equipment repairs per unit over a quarter. Assume \(Y_i\mid x_i\sim\operatorname{Poisson}(\lambda_i)\), where \(\lambda_i=E[Y_i\mid x_i]\). A proposed identity-link model has \(\eta_i=-0.4+0.2x_i\). For a unit with \(x_i=0\), assess the fitted mean, and then calculate the mean using a log link with the same predictor.

Method and assumptions. The Poisson parameter is \(\lambda_i\), and it must satisfy \(\lambda_i\geq0\). The identity inverse is \(\lambda_i=\eta_i\); the log-link inverse is \(\lambda_i=e^{\eta_i}\). We compare the two means at the stated covariate value.

First, the predictor is

$$ \eta_i=-0.4+0.2(0)=-0.4. $$

Under the identity link, \(\hat\lambda_i=-0.4\). This violates the required \(\lambda_i\geq0\), so it is an invalid Poisson mean. Under the log link,

$$ \hat\lambda_i=e^{-0.4}\approx0.670320. $$

The log-link fitted mean is approximately \(0.6703\) repairs per unit per quarter, to four decimal places. It is positive and therefore satisfies the Poisson mean constraint. It need not be an integer: the response count is an integer, but its expected value may be fractional.

Check. The identity result is negative and invalid; the log-link result is positive and valid. The mistake to avoid is assuming that a nonnegative count response automatically makes every fitted mean nonnegative, regardless of link.

Worked Example: Checking an Inverse-Link Severity Model

A hypothetical insurer models claim severity in thousands of dollars for claims with positive amounts. Assume \(Y_i\mid z_i\) has a Gamma distribution with mean \(\mu_i>0\) and variance \(\operatorname{Var}(Y_i\mid z_i)=0.5\mu_i^2\). A proposed inverse-link model has \(\eta_i=0.5-0.2z_i\), with \(g(\mu_i)=1/\mu_i\). Assess the prediction at \(z_i=1\) and at \(z_i=3\).

Method and assumptions. The Gamma distribution is parameterized here by its mean \(\mu_i\) and dispersion \(\phi=0.5\), so its variance is \(\phi\mu_i^2\). Its mean must be strictly positive. For the inverse link, \(\mu_i=1/\eta_i\) is defined as a positive mean only when \(\eta_i>0\).

At \(z_i=1\),

$$ \eta_i=0.5-0.2(1)=0.3, \qquad \hat\mu_i=\frac{1}{0.3}=3.\overline{3}. $$

The fitted mean is \(3.3333\) thousand dollars to four decimal places, or \(\$3{,}333.33\) to the nearest cent. It is positive and is within the Gamma mean’s required range.

At \(z_i=3\),

$$ \eta_i=0.5-0.2(3)=0.5-0.6=-0.1, \qquad \hat\mu_i=\frac{1}{-0.1}=-10. $$

The inverse is defined numerically, but the resulting mean is negative and invalid for a Gamma response. If \(\eta_i=0\), the inverse link would instead be undefined. Thus, using an inverse link for a positive response does not itself guarantee positive predictions; the predictor must remain positive.

Check. The predictor at \(z_i=1\) is positive and gives a positive severity mean. At \(z_i=3\), it is negative and gives an impossible negative mean. The common mistake is to check only whether \(1/\eta_i\) can be calculated, rather than whether it belongs to the response’s valid range.

Unrestricted Means and Context-Specific Validity

A Gaussian response has a mean that is unrestricted on the real line. With a Gaussian model \(Y_i\mid x_i\sim N(\mu_i,\sigma^2)\), where the second parameter is the variance, the identity link allows \(\mu_i=\eta_i\) to be any real number. This is not a flaw if negative and positive conditional means are both possible for the modeled quantity.

However, a response family’s mathematical support does not settle whether a model makes sense for a particular business target. A Gaussian model for claim severity can assign positive probability to negative observed values, even though actual claim amounts cannot be negative. Likewise, an identity-link mean for a strictly positive response can be negative. The analyst must distinguish the link’s range from the response’s domain and from the substantive meaning of the outcome.

Worked Example: When a Negative Mean Is Valid

A hypothetical facilities group models the quarterly change in energy use, measured as the difference from the previous quarter in kilowatt-hours. Suppose \(Y_i\mid x_i\sim N(\mu_i,4)\), so the conditional variance is 4 kilowatt-hours squared, and an identity-link model gives \(\eta_i=1.2-0.6x_i\). For \(x_i=6\), calculate the fitted mean and decide whether its sign is invalid.

Method and assumptions. The Gaussian distribution is parameterized as \(N(\mu_i,\sigma^2)\) with \(\sigma^2=4\), and the response is a change, not a level. The identity link gives \(\hat\mu_i=\eta_i\); Gaussian means are unrestricted real numbers.

Substitute the covariate value:

$$ \eta_i=1.2-0.6(6)=1.2-3.6=-2.4, \qquad \hat\mu_i=-2.4. $$

The predicted average change is \(-2.4\) kilowatt-hours. This is valid because a change can be negative: it represents a decrease in energy use. The Gaussian mean is allowed to be any real number. This does not assert that every observed change must be negative; the model describes a conditional mean, and the Gaussian distribution describes variation around that mean.

Check. The negative prediction is valid for a change on an unrestricted real scale. If the response were instead the level of energy use, a negative fitted mean would violate the target’s nonnegative range. The correct assessment depends on what the response measures, not only on the family name.

A Practical Validity Check

For a fitted GLM, use the following sequence before interpreting predictions. It separates the calculation from the domain check and makes it less likely that a plausible-looking number will be accepted without scrutiny.

1
Identify the response and its mean range.
Determine whether the target is a probability, count mean, strictly positive amount, or unrestricted-real quantity.
2
Calculate the linear predictor.
Evaluate \(\eta=x^\mathsf{T}\hat\beta\) using the stated covariates and coefficients.
3
Apply the inverse link.
Compute \(\hat\mu=g^{-1}(\eta)\), checking first that the inverse is defined at the calculated predictor.
4
Compare with the required range.
Confirm that the fitted mean is in the response’s allowable domain, and report any violation explicitly.

A link that maps all real predictors into a valid range provides a useful guarantee for that constraint. The logit, probit, and complementary log-log links guarantee probabilities strictly between 0 and 1. The log link guarantees positive means. In contrast, the identity link does not constrain a predictor, and the inverse link requires a positive predictor to produce a positive mean.

These guarantees are limited. A link that guarantees a mathematically valid mean does not establish that the chosen response family, predictors, or fitted relationship are appropriate. For example, a log link can produce a positive value larger than 1, which is valid as a positive count or severity mean but invalid as a probability. Conversely, a fitted probability of \(0.7\) is within the probability range but is not automatically a well-calibrated prediction.

Common Exam Traps

  • Using the linear predictor as the fitted mean without checking the link. This is correct only for an identity link. With a logit link, for example, the fitted probability is the inverse-logit of \(\eta\), not \(\eta\) itself.
  • Assuming a log link guarantees probabilities. It guarantees a positive mean, but \(e^\eta\) can exceed 1. A probability must also be at most 1.
  • Assuming a positive response guarantees positive fitted means. An identity link can produce a negative fitted mean, and an inverse link can produce one if \(\eta<0\).
  • Confusing the mean’s range with the observed response’s range. A Poisson mean may be fractional even though each observed count is an integer.
  • Treating negative predictions alike for every target. A negative expected change can be meaningful; a negative expected claim amount generally cannot.
  • Assuming the link resolves every modeling issue. Range validity is a necessary check when the outcome has constraints, but it does not by itself establish model adequacy.
Key takeaway: A GLM predicts on the response scale by applying the inverse link to the linear predictor. Check the inverse-link range against the response mean’s required domain: a valid linear predictor alone does not guarantee a valid fitted mean.

Check Your Understanding

For each question, identify the relevant range constraint and assess the prediction.

  1. A Bernoulli model has a logit linear predictor of \(\eta=0.4\). Calculate the fitted probability to four decimal places. (Answer: \(1/(1+e^{-0.4})\approx0.5987\), a valid probability.)
  2. A Poisson model uses the identity link and has \(\eta=-0.25\) for a particular observation. Is the fitted mean valid? What would the mean be at the same predictor under a log link, to four decimal places? (Answer: The identity-link mean \(-0.25\) is invalid; the log-link mean is \(e^{-0.25}\approx0.7788\), which is valid.)
  3. A binary-outcome model uses a probit link and has \(\eta=-1.25\). Give the fitted probability to four decimal places and state whether it satisfies the probability range. (Answer: \(\Phi(-1.25)\approx0.1056\), which is valid.)
  4. A Gamma model uses the inverse link \(g(\mu)=1/\mu\). At one covariate value, \(\eta=0.2\); at another, \(\eta=-0.1\). Assess each fitted mean. (Answer: At \(\eta=0.2\), \(\hat\mu=5\), a valid positive mean; at \(\eta=-0.1\), \(\hat\mu=-10\), an invalid Gamma mean.)
  5. A Gaussian identity-link model predicts a mean of \(-2.4\) for a response defined as a quarterly change. Is the prediction invalid solely because it is negative? What if the response were a nonnegative claim amount? (Answer: No for a change, which can be negative; yes for a nonnegative claim amount, because a negative fitted mean violates its range.)
Clinical Biostats