Tutorials › Generalized Linear Models › Defining Candidate GLM Sets

Selection and Predictive Comparison · Tutorial 799 of 981

Defining Candidate GLM Sets

Build explicit GLM candidates from the scientific question, and distinguish a model’s intended structure from the mean vectors it can actually represent.

Advanced 12 min read

What You'll Learn

  • Specify the response distribution and observational units for each candidate
  • Define predictors, link functions, offsets, and interaction structures explicitly
  • Distinguish a model specification from one fitted parameter value
  • Describe admissible linear predictors and attainable mean vectors
  • Identify when design-matrix column spaces characterize model nesting
  • Recognize candidate-set choices that can undermine scientific interpretation

Why Define the Candidate Set Before Fitting?

Model comparison is meaningful only after the candidate models have been stated clearly. A candidate set is not simply a list of formulas generated from whichever variables happen to be available. Each model encodes assumptions about the response distribution, the predictors and their functional form, the link between the mean and the linear predictor, any known offsets, and the interactions under consideration. Those choices should reflect the study design and scientific question, rather than being improvised after looking for a favorable result.

This tutorial concerns how to construct and describe that set. It does not decide which candidate is best. For now, the goal is to make each candidate precise enough that its implied probability model and scientific interpretation are unambiguous.

Definition: A candidate GLM is a fully specified model class for the observed response: it states the response distribution (including its support and any relevant dispersion specification), the mean structure and predictors, the link function, any known offsets, and any parameter restrictions. A fitted model is one particular parameter estimate within that class; it is not itself the candidate model.

Specify the Components

For independent responses \(Y_1,\ldots,Y_n\), a common GLM specification gives each observation a distribution from a stated family, with mean \(\mu_i=E[Y_i]\) and a link relation \(\eta_i=g(\mu_i)\). A predictor structure with design matrix \(X\), coefficient vector \(\beta\), and known offset vector \(o\) has \(\eta=o+X\beta\). The offset enters with its coefficient fixed at one. Which distributions, links, and mean values are valid depends on the response and the family.

A clear candidate description answers the following questions.

  • What is the response? State what is observed for each observational unit, its support, and the assumed family. For grouped binary data, for example, specify successes and trials rather than describing a proportion as if it were an unweighted binary outcome.
  • Which predictors are included, and how are they represented? Identify transformations, factor contrasts, and any scientifically motivated grouping or functional form. A predictor name alone does not specify its coding or form.
  • Which link is used? State the link and check that its domain and the resulting means are valid for the response family.
  • Are there offsets? Name each known offset and explain why its coefficient is fixed at one. An offset is not an ordinary predictor whose coefficient is estimated.
  • Which interactions are included? State the interacting variables and how the interaction enters the linear predictor. Do not leave “interaction model” undefined.
  • What parameter restrictions apply? State any constraints, such as a restricted coefficient set, because they affect which predictor and mean vectors the model can attain.

These are model-definition decisions, not results of fitting. In particular, a candidate set should be recorded in terms of a scientific rationale and explicit specifications before its members are compared. A variable can be scientifically important even if it is not included in every candidate; conversely, adding terms solely because a search found them useful can make the set difficult to interpret.

Worked Example: A Poisson Rate Model With Exposure

A hospital records event counts for four wards. Their exposures, in patient-days, are \(10,20,15,25\), and the wards are A, B, A, B. Define a Poisson log-link candidate with a ward effect and exposure offset.

Let \(Y_i\) be the count for ward-period \(i\), and assume the four counts are independent with \(Y_i\sim\operatorname{Poisson}(\mu_i)\). Write \(I_{Bi}=1\) for ward B and \(0\) for ward A. The specified candidate is \(\log(\mu_i)=\log(t_i)+\beta_0+\beta_1 I_{Bi}\), where \(t_i\) is the known patient-day exposure. Equivalently, \(\mu_i=t_i\exp(\beta_0+\beta_1 I_{Bi})\). The offset \(\log(t_i)\) has coefficient one; \(\beta_1\) describes a rate ratio, not a count ratio detached from exposure.

To check the interpretation, take the illustrative parameter values \(\beta_0=\log(0.02)\) and \(\beta_1=\log(1.5)\). Ward A has rate \(0.02\) per patient-day, and ward B has rate \(0.02(1.5)=0.03\). The four expected counts are therefore \(10(0.02)=0.2\), \(20(0.03)=0.6\), \(15(0.02)=0.3\), and \(25(0.03)=0.75\), in the stated order. These values illustrate the candidate’s meaning; they are not fitted estimates.

A second candidate could omit the ward indicator while keeping the same response, link, and offset. It would assert a common event rate across wards. Stating precisely what stays fixed and what changes makes the candidates interpretable before any comparison.

Admissible Predictors and Attainable Means

The design matrix alone does not always tell the whole story about a candidate. Coefficients may be constrained, and some links or mean domains may rule out certain linear predictors. It is useful to define the sets involved explicitly.

Definition: For a candidate with offset \(o\), design matrix \(X\), permitted coefficient set \(B\), link \(g\), and admissible mean domain \(M\), define its admissible predictor set as \(A=\{o+X\beta:\beta\in B,\;g^{-1}(o_i+x_i^\mathsf{T}\beta)\in M\text{ for every }i\}\), where the inverse link must be defined at every displayed predictor. Its attainable mean-vector set is \(\mathcal{M}=\{(g^{-1}(\eta_1),\ldots,g^{-1}(\eta_n))^\mathsf{T}:\eta\in A\}\).

This definition makes explicit why comparing column spaces without checking admissibility can be wrong. For instance, the identity link for a Bernoulli response requires every fitted mean to lie in \([0,1]\); not every vector in a design matrix’s column space will satisfy that requirement. The logit link, in contrast, maps every real predictor to a mean strictly between zero and one.

Theorem: Suppose two candidates use the same observations, the same one-to-one link \(g\), and the same offset vector \(o\). Let their admissible predictor sets be \(A_1,A_2\), and their attainable mean-vector sets be \(\mathcal{M}_1,\mathcal{M}_2\). Then \(\mathcal{M}_1\subseteq\mathcal{M}_2\) if and only if \(A_1\subseteq A_2\). If, in addition, both candidates have unrestricted coefficients, the inverse link is defined and gives valid means for every real predictor, and their design matrices are \(X_1,X_2\), then \(\mathcal{M}_1\subseteq\mathcal{M}_2\) if and only if \(\mathcal{C}(X_1)\subseteq\mathcal{C}(X_2)\).

Proof. Because the link is one-to-one, its inverse is one-to-one on its image. Applying \(g^{-1}\) componentwise therefore maps distinct admissible predictor vectors to distinct mean vectors. If \(A_1\subseteq A_2\), applying this map gives \(\mathcal{M}_1\subseteq\mathcal{M}_2\). Conversely, suppose \(\mathcal{M}_1\subseteq\mathcal{M}_2\). For any \(\eta\in A_1\), its mean vector belongs to \(\mathcal{M}_1\), hence to \(\mathcal{M}_2\). There is an \(\eta'\in A_2\) with the same componentwise inverse-link image. Injectivity implies \(\eta=\eta'\), so \(\eta\in A_2\). Thus \(A_1\subseteq A_2\).

Under the additional conditions, every \(\beta\) is permitted and every real predictor vector is admissible. Thus \(A_j=o+\mathcal{C}(X_j)\) for \(j=1,2\). Since the offset is the same, \(A_1\subseteq A_2\) holds exactly when \(\mathcal{C}(X_1)\subseteq\mathcal{C}(X_2)\): subtracting \(o\) from both sets yields the column-space inclusion. The first equivalence now gives the claimed mean-vector result. \(\square\)

The additional assumptions matter. Without them, the column-space condition need not characterize attainable means. For example, take two Bernoulli observations, zero offsets, and the identity link. With \(X_1=(1,-1)^\mathsf{T}\), a predictor vector has the form \((\beta,-\beta)^\mathsf{T}\). Requiring both means to lie in \([0,1]\) forces \(\beta=0\), so this candidate attains only \((0,0)^\mathsf{T}\). With \(X_2=(0,0)^\mathsf{T}\), the only attainable mean vector is also \((0,0)^\mathsf{T}\). Yet \(\mathcal{C}(X_1)\) is not a subset of \(\mathcal{C}(X_2)\). Describing the admissible predictor sets avoids this false conclusion.

Equivalent Predictor Codings

A model’s formula can change without changing its candidate mean structure. For example, different full-rank contrast codings for a factor can describe the same predictor space. This is why candidate definitions should be understood through the implied predictors and constraints, not just by comparing the written coefficient names.

Result: Suppose two candidates have the same response family, link, and offset, and unrestricted coefficients. If their design matrices have the same column space and all predictors in that space are admissible, the candidates have the same attainable mean-vector set.

Proof. For each design matrix \(X_j\), unrestricted coefficients produce exactly the predictor vectors \(o+v\) for \(v\in\mathcal{C}(X_j)\). Equality of the column spaces therefore gives equality of the predictor sets. The common inverse link maps equal predictor sets to equal mean-vector sets. \(\square\)

For example, suppose \(X_2=X_1A\) for a nonsingular square matrix \(A\). Then \(\mathcal{C}(X_2)=\mathcal{C}(X_1A)=\mathcal{C}(X_1)\), since multiplication by \(A\) merely gives a one-to-one reparameterization of the coefficient vector. The resulting fitted means are unchanged as a set. This result requires the stated unrestricted coefficients and admissibility; restrictions introduced by a particular parameterization must also be considered.

Worked Example: Two Link Choices for Grouped Binary Data

Suppose two groups each contribute a binomial count: \(Y_1\) out of \(n_1=20\) and \(Y_2\) out of \(n_2=40\). Consider candidates with \(Y_i\sim\operatorname{Binomial}(n_i,p_i)\), group indicator \(x_i=0,1\), and predictors \(\eta_i=\beta_0+\beta_1x_i\). One candidate uses the logit link; another uses the complementary log-log link \(g(p)=\log[-\log(1-p)]\).

For the logit candidate, \(p_i=\exp(\eta_i)/(1+\exp(\eta_i))\). At the illustrative values \(\beta_0=-1,\beta_1=1\), the group A predictor is \(-1\), giving \(p_1=1/(1+e)\approx0.269\). Group B has predictor \(0\), giving \(p_2=1/2=0.5\). The corresponding expected successes are \(20(0.269)\approx5.38\) and \(40(0.5)=20\).

For the complementary log-log candidate, the inverse link is \(p_i=1-\exp[-\exp(\eta_i)]\). At the same coefficient values, group A has \(p_1=1-\exp(-e^{-1})\approx0.308\), and group B has \(p_2=1-\exp(-1)\approx0.632\). The expected successes are approximately \(20(0.308)=6.16\) and \(40(0.632)=25.28\).

Both specifications use the same grouped-binomial response and predictor, but they imply different mean structures. Their candidate descriptions must therefore name the link; “binomial regression on group” is not enough. The numerical values above are illustrations of the formulas, not a comparison based on fitted models.

State Interaction Structures Explicitly

An interaction allows the association for one predictor to vary across levels of another. It is a structural choice in the candidate definition. For two binary factors \(A\) and \(T\), treatment coding with indicators \(a,t\) gives the predictor \(\eta=\beta_0+\beta_Aa+\beta_Tt+\beta_{AT}at\). Without the interaction term, the predictor is additive on the link scale. Whether that is scientifically plausible is a question about the study and its mechanism; the interaction should not be an unexplained extra column in a design matrix.

Worked Example: Defining a Two-Factor Interaction Candidate

Suppose counts follow independent Poisson distributions with a log link and a common known exposure of 100 units per cell. Let \(A=1\) denote a new treatment and \(T=1\) denote a follow-up period. Define an interaction candidate by \(\log(\mu)=\log(100)+\beta_0+\beta_Aa+\beta_Tt+\beta_{AT}at\).

Use \(\beta_0=\log(2)\), \(\beta_A=\log(1.5)\), \(\beta_T=\log(2)\), and \(\beta_{AT}=\log(0.5)\). The four cell rates, obtained by exponentiating the part after the offset, are:

  • When \(a=0,t=0\), the rate is \(2\), so the expected count is \(100(2)=200\).
  • When \(a=1,t=0\), the rate is \(2(1.5)=3\), so the expected count is \(300\).
  • When \(a=0,t=1\), the rate is \(2(2)=4\), so the expected count is \(400\).
  • When \(a=1,t=1\), the rate is \(2(1.5)(2)(0.5)=3\), so the expected count is \(300\).

The interaction multiplier is \(0.5\): the treatment rate ratio is \(1.5\) at \(t=0\), and \(1.5(0.5)=0.75\) at \(t=1\). This example specifies what the interaction means on the log-rate scale. A candidate without the interaction would instead predict a rate \(2(1.5)(2)=6\) in the final cell, or an expected count of \(600\). Neither set of values is evidence for choosing one candidate; they simply show the structural distinction.

Common Mistakes and a Practical Specification Check

  • Treating a fitted coefficient vector as the candidate. A candidate is the full model class, including all permitted parameter values and restrictions. The estimates are one fitted instance.
  • Leaving out the response denominator or exposure. A binomial sample size and a count-model exposure affect the mean specification. State them, and distinguish a known offset from an estimated coefficient.
  • Assuming equal formula labels imply equal models. A term’s coding, transformation, link, and constraints can change the set of attainable means.
  • Assuming column-space inclusion always proves nesting. It does so under appropriate common-link, common-offset, unrestricted-coefficient, and admissibility conditions. In general, compare the admissible predictor or attainable mean sets instead.
  • Defining candidates after searching for a favorable result. A set assembled opportunistically can make the scientific interpretation and later assessment unreliable. Record the rationale and specifications before fitting and comparison.

Before proceeding, write each candidate in a compact registry: response and distribution; observational units; predictors and coding; link; offsets; interaction terms; and coefficient constraints. Check that every candidate refers to the intended observations and that its means are valid for the response. The resulting set is a transparent basis for later assessment, without prematurely deciding how those candidates should be ranked.

Check Your Understanding

Use the definitions and examples above to answer the following questions.

  1. What information distinguishes a fully specified candidate GLM from a list of predictor names?
  2. Why must an exposure offset in a Poisson log-link model be distinguished from an estimated predictor coefficient?
  3. For which assumptions does inclusion of design-matrix column spaces imply inclusion of attainable mean-vector sets?
  4. In the Bernoulli identity-link example, why do the two candidates have equal attainable mean sets despite different column spaces?
  5. How does the interaction coefficient in the Poisson example change the treatment rate ratio between time periods?
Clinical Biostats