Tutorials › Generalized Linear Models › Distinguishing Family Mismatch From Unmodeled Structure

Choosing Continuous Families · Tutorial 647 of 981

Distinguishing Family Mismatch From Unmodeled Structure

Use conditional residual patterns to tell whether apparent extra variation or skewness is more consistent with a wrong response family or with omitted mean structure.

Intermediate 11 min read

What You'll Learn

  • Define conditional residual patterns that signal a misspecified mean.
  • Derive how omitted structure can inflate residual variation.
  • Compare residual behavior across covariates, groups, and fitted means.
  • Distinguish a mean-pattern problem from remaining variance or shape mismatch.
  • Apply the distinction in three fully worked examples.

Why the Source of a Residual Pattern Matters

A fitted model can show more residual variation than expected, or residuals can appear skewed, even when the chosen response family is not the main problem. If the mean model omits curvature, a group effect, or another systematic component, observations with similar covariate values may have residuals of the same sign. Pooling those residuals can make the response look more variable or differently shaped than it is after the mean structure is accounted for.

The useful question is therefore not simply whether residuals look unusual. It is whether their behavior changes systematically with covariates, groups, or fitted means. A persistent conditional mean pattern points first to the systematic part of the model. If the mean is adequately represented but the residual spread or shape still differs from what the candidate family predicts, family mismatch becomes a more plausible explanation. These clues guide model checking; they do not prove a unique cause.

Conditional Mean and Residual Definitions

Let \(Y\) be a continuous response and \(X\) the covariates. Write the true conditional mean and variance as \(\mu_0(X)=E[Y\mid X]\) and \(\operatorname{Var}(Y\mid X)\). A fitted GLM specifies a mean function \(m(X)\), typically through a linear predictor and link, and a candidate family supplies a variance function. Write the fitted variance benchmark as \(v(X)>0\). For an observation evaluated at these fixed functions, define the raw residual \(e=Y-m(X)\) and the standardized residual \(R=e/\sqrt{v(X)}\).

Definition: A mean-structure mismatch occurs when \(m(X)\) does not represent the true conditional mean \(\mu_0(X)\). A response-family mismatch is a discrepancy between the conditional distribution of \(Y\), after accounting for its mean structure, and the distributional shape or variance behavior implied by the candidate family. The two problems can occur together.

In practice, \(m\) and \(v\) are estimated, so residuals use fitted values such as \(\hat{\mu}_i\) and an estimated dispersion. The identities below describe fixed functions, or predictions evaluated on observations independent of the data used to fit them. They clarify the population patterns to look for. In-sample fitted residuals also reflect parameter estimation and leverage, so their appearance is not a direct, unaltered view of the population residuals.

What Residual Patterns Say About the Mean

Theorem: Suppose \(E[Y^2\mid X]<\infty\) almost surely, \(m(X)\) is finite, and \(v(X)\) is positive and finite almost surely. Then $$ E[R\mid X]=\frac{\mu_0(X)-m(X)}{\sqrt{v(X)}} $$ and $$ E[R^2\mid X]=\frac{\operatorname{Var}(Y\mid X)+\{\mu_0(X)-m(X)\}^2}{v(X)}. $$ Thus a nonzero conditional mean of the residual indicates a mean discrepancy, while the conditional residual second moment includes both the true variance and the squared mean discrepancy.

Proof. Conditional second-moment finiteness implies conditional first-moment finiteness almost surely. Since \(m(X)\) and \(v(X)\) are functions of \(X\), they are fixed when conditioning on \(X\). Therefore, $$ E[R\mid X] =\frac{E[Y-m(X)\mid X]}{\sqrt{v(X)}} =\frac{\mu_0(X)-m(X)}{\sqrt{v(X)}}. $$ For the second identity, write $$ Y-m(X)=\{Y-\mu_0(X)\}+\{\mu_0(X)-m(X)\}. $$ On squaring and taking conditional expectations, the cross term is zero because \(E[Y-\mu_0(X)\mid X]=0\). The remaining terms give $$ E[(Y-m(X))^2\mid X] =\operatorname{Var}(Y\mid X)+\{\mu_0(X)-m(X)\}^2. $$ Dividing by \(v(X)\) proves the stated expression for \(E[R^2\mid X]\). \(\square\)

This result explains a central diagnostic distinction. A systematic trend in residual averages across a covariate, a group, or fitted means is evidence to investigate the mean structure. A correct mean model has \(E[R\mid X]=0\), even if the variance function is wrong. Conversely, an omitted mean component adds a nonnegative squared discrepancy to the residual second moment, so residuals may look excessively variable even when the conditional response family is otherwise appropriate.

Worked Example: Omitted Curvature Creates a Residual Trend

Suppose \(x\) takes the five equally weighted values \(-2,-1,0,1,2\), and the true conditional mean is \(\mu_0(x)=10+2x+1.5x^2\). Consider fitting only an intercept and a linear term. Find the linear projection of the true means and the resulting conditional mean residuals.

For these symmetric values, \(\bar{x}=0\), the average of \(x^2\) is \((4+1+0+1+4)/5=2\), and the average of \(x^3\) is zero. The least-squares slope is 2: the linear term \(2x\) is retained, while the symmetric quadratic term has zero projection onto \(x\). The fitted intercept is the average true mean, \(10+1.5(2)=13\). Thus the fitted mean is \(m(x)=13+2x\).

The conditional residual mean is \(\mu_0(x)-m(x)=1.5(x^2-2)\). It equals 3 at \(x=-2\) and \(x=2\), \(-1.5\) at \(x=-1\) and \(x=1\), and \(-3\) at \(x=0\). These five values average to zero, but they form a clear pattern across \(x\). If the true conditional variance is 4 and the candidate variance benchmark is \(v(x)=4\) at all five points, the conditional mean of the standardized residual is each value divided by 2: 1.5, \(-0.75\), \(-1.5\), \(-0.75\), and 1.5, respectively.

The apparent large residuals at the ends do not, by themselves, establish a wrong response family. Here the cause is an omitted quadratic mean term. A residual-versus-\(x\) plot, or residual averages over ranges of \(x\), exposes that structure.

Group Structure Can Masquerade as Extra Variation

An omitted group effect creates a related pattern. Residuals can average near zero overall while being predominantly positive in one group and negative in another. Pooling the groups conceals this conditional mean pattern and increases the overall residual spread. The variance decomposition makes the mechanism explicit.

Result: If \(Y\) has a finite second moment and \(G\) is a group variable, then $$ \operatorname{Var}(Y)=E[\operatorname{Var}(Y\mid G)]+\operatorname{Var}(E[Y\mid G]). $$ The first term is within-group variation; the second is variation among group means.

Derivation. Let \(\mu_G=E[Y\mid G]\). Add and subtract \(\mu_G\) inside the squared deviation: $$ Y-E[Y]=(Y-\mu_G)+(\mu_G-E[Y]). $$ The cross term has expectation zero, since \(E[Y-\mu_G\mid G]=0\). Taking expectations of the two squared terms gives \(E[\operatorname{Var}(Y\mid G)]\) and \(\operatorname{Var}(E[Y\mid G])\), respectively. This proves the decomposition. \(\square\)

Worked Example: A Missing Group Effect Inflates Residual Variation

Suppose half the observations are in group A and half in group B. In group A, the response has mean 10 and variance 4; in group B, it has mean 20 and variance 16. A model omits group and uses the common mean 15. Calculate its residual mean by group and its pooled residual second moment.

The common mean is the average of the group means: \((10+20)/2=15\). The conditional residual mean in A is \(10-15=-5\), and in B it is \(20-15=5\). Thus the pooled residual mean is zero, although the group-specific residual means are not.

For group A, the expected squared residual about 15 is its variance plus the squared difference between its mean and 15: \(4+(-5)^2=29\). For group B it is \(16+5^2=41\). The pooled residual second moment is \((29+41)/2=35\). Equivalently, the variance decomposition gives average within-group variance \((4+16)/2=10\), plus between-group variance \(\{(-5)^2+5^2\}/2=25\), totaling 35.

For scale, suppose a candidate variance benchmark uses a constant coefficient of variation of 0.2, so \(v(\mu)=0.04\mu^2\). At the fitted mean 15, \(v(15)=0.04(225)=9\). The pooled standardized residual second moment is therefore \(35/9\), approximately 3.89. But within each group the residual mean is systematically nonzero. The first diagnostic question should be whether group belongs in the mean model, not whether a more dispersed family alone will resolve the pattern.

When the Mean Looks Adequate, Examine Conditional Shape

After checking for residual trends across covariates and groups, examine spread and shape within reasonably comparable portions of the data. A variance pattern that changes with fitted means in the way a candidate family does not predict can indicate a variance-family mismatch. Persistent asymmetry or tail behavior within covariate and fitted-mean ranges can likewise motivate reconsidering the family. A pooled residual histogram is less informative when observations come from different mean levels: mixing conditional distributions can itself create asymmetry or heavy tails.

Worked Example: Different Skewness After Matching Mean and Variance

Compare two positive-response families at conditional mean 10 and variance 25. First take a lognormal response \(Y\) with log-scale variance \(\sigma^2=\ln(1.25)\) and log-scale mean \(\mu_{\log}=\ln(10)-\sigma^2/2\). For a lognormal variable, \(E[Y]=\exp(\mu_{\log}+\sigma^2/2)=10\), and $$ \operatorname{Var}(Y)=\{\exp(\sigma^2)-1\}\exp(2\mu_{\log}+\sigma^2) =(1.25-1)(10)^2=25. $$ Its skewness is \((\exp(\sigma^2)+2)\sqrt{\exp(\sigma^2)-1}=3.25(0.5)=1.625\).

Now take a Gamma response with shape \(k=4\) and scale \(\theta=2.5\). Its mean is \(k\theta=10\), its variance is \(k\theta^2=25\), and its skewness is \(2/\sqrt{k}=1\). Thus the two families agree on mean and variance but differ in skewness. If residuals show no systematic pattern across covariates, groups, or fitted means, yet conditional residual shapes repeatedly show a heavier positive tail than the Gamma model predicts, that is evidence to investigate family shape. It is not evidence for omitted curvature unless a mean pattern is also present.

A Practical Order for Interpreting Patterns

1
Look for conditional residual averages.
Plot residuals against each important covariate and fitted mean, and compare their averages across meaningful groups or ranges. Persistent positive or negative averages suggest a mean structure to investigate.
2
Check whether spread changes with structure.
Compare residual spread across the same covariate, group, and fitted-mean ranges. An apparent overall excess may be driven by distinct conditional means rather than by a response family that is too restrictive.
3
Assess shape after accounting for mean patterns.
Within comparable ranges, look at asymmetry and tail behavior relative to the candidate family. Remaining shape discrepancies are more relevant to family choice once the mean is adequately represented.
4
Reassess after a change.
If a scientifically defensible mean term is added, revisit the residual patterns. A reduced residual trend or spread supports the structural explanation; it does not automatically establish that every aspect of the family is correct.

These steps are a way to organize evidence, not a mechanical selection rule. Sparse groups, influential observations, limited sample size, and uncertainty in estimated fitted means can obscure or imitate patterns. Replicated predictive checks and substantive knowledge remain useful complements, especially when several explanations fit the same residual evidence.

Common Mistake

Wrong reasoning: “The pooled standardized residuals have a large second moment, so the response family must allow more variation.” This skips the possibility that residual means differ across covariates or groups. As the examples show, squared residuals include a contribution from the squared mean error, and mixing groups adds between-group variation. Correction: first check conditional residual averages and whether spread changes systematically with covariates, groups, or fitted means. Then evaluate variance and shape relative to a family after the mean structure has been examined. Neither a large spread nor a skewed pooled plot identifies its cause by itself.

Key takeaway: Mean patterns and family patterns are different kinds of evidence. Residual averages that vary with covariates or groups point toward systematic mean structure; residual spread or shape that remains discrepant after that structure is addressed points toward a response-family question. Both explanations may be needed.

Check Your Understanding

Use the conditional residual identities to reason through each question.

  1. If residual averages are positive at low fitted means and negative at high fitted means, what model component should be examined before changing the response family?
  2. Why can a model that omits a group effect have a pooled residual mean of zero but an inflated residual second moment?
  3. With \(m(X)=\mu_0(X)\), what is \(E[R\mid X]\), even if \(v(X)\) is an inaccurate variance benchmark?
  4. Two candidate families match the conditional mean and variance but differ in skewness. What residual evidence would make their shape difference relevant?
  5. Why should residual behavior from an in-sample fit be interpreted with care when using the fixed-function identities?
Clinical Biostats