Tutorials › Population Pharmacokinetics › Joint Tests for Categorical Covariates

Covariate Selection Strategies and Their Statistics · Tutorial 293 of 599

Joint Tests for Categorical Covariates

You will learn to formulate and interpret joint likelihood-ratio and Wald tests for categorical covariates, select reference coding, and recognize when individual contrasts answer a different question.

Advanced 12 min read

What You'll Learn

  • Encode a categorical covariate with one indicator per nonreference level.
  • State the joint null hypothesis for a factor with multiple levels.
  • Calculate and interpret likelihood-ratio and Wald tests for that hypothesis.
  • Explain how changing the reference category affects coefficients but not the global test.
  • Distinguish an omnibus factor test from individual level contrasts.
  • Identify conditions and diagnostics that affect the reliability of joint tests.

Why Test a Categorical Covariate Jointly?

A categorical covariate with several levels is represented by several coefficients in a typical population pharmacokinetic model. For example, a four-level formulation or clinical group generally requires three coefficients when one level is the reference. Testing each coefficient separately is not the same question as asking whether the covariate, as a whole, contributes to the model. A joint test addresses that overall question while respecting the factor's multi-parameter representation.

This distinction matters in covariate selection: a factor may have evidence of an overall association even when no single coefficient is especially compelling after accounting for uncertainty or multiple comparisons. Conversely, a particular level contrast may be of scientific interest even if the omnibus test is not significant. The hypotheses must therefore be stated before interpreting the result.

Definition: For a categorical covariate with \(K\) levels, a joint test tests whether all \(K-1\) coefficients representing that covariate are zero simultaneously. Under reference coding, the null hypothesis is \(H_0:\beta_1=\beta_2=\cdots=\beta_{K-1}=0\). The alternative is that at least one of these coefficients is nonzero. The test concerns the factor's overall contribution in the specified model, not whether every pair of levels differs.

Reference Coding and the Joint Hypothesis

Suppose a categorical covariate \(C\) has levels A, B, and C, with A chosen as the reference. In a model for the typical value of clearance, one possible specification is

$$ TVCL_i=TVCL_{\mathrm{pop}}\exp\left(\beta_B I(C_i=B)+\beta_C I(C_i=C)\right). $$

Here \(I(\cdot)\) equals 1 when the statement is true and 0 otherwise. The reference group has both indicators equal to zero, so its typical clearance is \(TVCL_{\mathrm{pop}}\). The other groups have typical clearances \(TVCL_{\mathrm{pop}}\exp(\beta_B)\) and \(TVCL_{\mathrm{pop}}\exp(\beta_C)\). Thus, \(\beta_B\) and \(\beta_C\) are log ratios relative to A, and exponentiating a coefficient gives the corresponding ratio of typical clearances.

For this three-level factor, the joint null is \(H_0:\beta_B=\beta_C=0\), with two restrictions. It says that, conditional on the other terms in the model, the typical clearance is the same across all three levels under this parameterization. It does not say that the coefficients are individually estimated with no uncertainty, nor does a rejection identify which levels differ.

Choosing a different reference level changes the coefficient values and their interpretations. It does not change the fitted model's possible predictions or the global hypothesis that all category effects are equal. The chosen reference should be clearly identified and should be scientifically interpretable; if a category is very sparse, its estimates and contrasts may be imprecise regardless of the coding.

Likelihood-Ratio Test for the Factor

A likelihood-ratio test compares two nested models fitted to the same observations: a reduced model that omits the factor and a full model that includes all its category coefficients. The models should otherwise have the same structural, random-effects, and residual-error specification. Under regularity conditions, maximum-likelihood estimation, and a null hypothesis that is not on a parameter-space boundary, twice the log-likelihood difference is approximately chi-square distributed. If an objective function is reported as \(-2\) times the log likelihood, subtract the full-model objective function from the reduced-model objective function. With \(K\) levels and reference coding, the degrees of freedom are \(K-1\), the number of added coefficients.

$$ LR=OFV_{\mathrm{reduced}}-OFV_{\mathrm{full}} \ \overset{H_0}{\approx}\ \chi^2_{K-1}. $$

The approximation is more credible when the model is identifiable, the estimates are not at problematic boundaries, and the sample contains sufficient information for the added effects. In nonlinear mixed-effects models, finite-sample behavior and numerical estimation can matter. A small objective-function difference should therefore be interpreted alongside model fitting diagnostics, rather than treated as self-validating evidence.

Worked Example: Likelihood-Ratio Test for a Three-Level Covariate

In a hypothetical analysis, a three-level administration group is added to a model for typical clearance. The reduced model has \(OFV=812.4\); the full model, which adds two group coefficients, has \(OFV=806.1\). Assume both models converged, used the same data and likelihood, and differ only by the two group coefficients.

Hypotheses and degrees of freedom. The joint null is that both nonreference-group coefficients equal zero. There are two restrictions, so \(df=2\).

Statistic.

$$ LR=812.4-806.1=6.3. $$

Under the null, compare 6.3 with a \(\chi^2\) distribution with 2 degrees of freedom. For \(df=2\), the upper-tail probability is \(\exp(-LR/2)\), giving \(\exp(-3.15)\approx0.0429\).

At a prespecified \(\alpha=0.05\), this is evidence against the joint null in this hypothetical model comparison. The result supports an overall group effect under the model and test assumptions; it does not establish that both nonreference groups differ from the reference or from each other. This interpretation also presumes the model fits adequately and the objective-function difference is not dominated by numerical error.

Wald Test for the Factor

A Wald test uses the estimated coefficient vector and its estimated covariance matrix. Let \(b\) contain the \(q=K-1\) fitted coefficients for the factor, and let \(\widehat V\) be their estimated covariance matrix from the full model. The joint Wald statistic is the squared distance of \(b\) from the null vector, measured using \(\widehat V\). Under the null and regular large-sample conditions, it is approximately \(\chi^2_q\).

$$ W=b^\mathsf{T}\widehat V^{-1}b \ \overset{H_0}{\approx}\ \chi^2_q. $$

This formula follows from the approximate sampling distribution \(b\approx N_q(0,\widehat V)\) under \(H_0\). If the covariance matrix is nonsingular, standardizing the coefficient vector by its covariance produces \(q\) approximately independent standard-normal components. The sum of their squares is approximately chi-square with \(q\) degrees of freedom, which yields the quadratic form above. This also explains why the joint test must use the covariance among coefficients, not just separate standard errors.

Worked Example: Joint Wald Test and One Level Contrast

In a hypothetical three-group analysis with group A as reference, the estimates are \(b=(0.24,-0.30)^\mathsf{T}\), for groups B and C. Their estimated covariance matrix is diagonal, with standard errors 0.120 and 0.111, respectively. Assume the estimates are sufficiently well behaved for the large-sample Wald approximation.

Joint test. The covariance matrix is \(\widehat V=\begin{pmatrix}0.120^2&0\\0&0.111^2\end{pmatrix}\). Therefore,

$$ W=\frac{0.24^2}{0.120^2}+\frac{(-0.30)^2}{0.111^2} =4.000+7.305=11.305. $$

There are two coefficients, so \(df=2\). The upper-tail probability is \(\exp(-11.305/2)\approx0.00351\). The joint test provides evidence that the group factor contributes to the model at \(\alpha=0.05\), subject to the approximation and model assumptions.

One coefficient is a different test. The Wald statistic for the C-versus-A coefficient is

$$ z=\frac{-0.30}{0.111}\approx-2.703. $$

Its two-sided normal-approximation p-value is about 0.0069. The coefficient is a log ratio for C relative to A; its point-estimated ratio is \(\exp(-0.30)\approx0.741\), or about 25.9% lower typical clearance for C than A in this model. This individual contrast does not replace the two-degree-of-freedom joint test, and its p-value answers only the C-versus-A question. The joint test also incorporates the B-versus-A coefficient.

The arithmetic assumes the stated diagonal covariance matrix; if the coefficient estimates were correlated, the off-diagonal elements would enter \(b^\mathsf{T}\widehat V^{-1}b\), and summing squared coefficient-to-standard-error ratios would generally be incorrect.

Contrasts, Reference Choice, and Interpretation

An individual coefficient under reference coding compares one category with the reference. A comparison between two nonreference categories instead tests a difference between their coefficients. For the three-level clearance model, the C-versus-B log ratio is \(\beta_C-\beta_B\), not \(\beta_C\). Its standard error depends on both coefficient variances and their covariance:

$$ SE(\hat\beta_C-\hat\beta_B) =\sqrt{\widehat{\mathrm{Var}}(\hat\beta_C)+\widehat{\mathrm{Var}}(\hat\beta_B)-2\widehat{\mathrm{Cov}}(\hat\beta_C,\hat\beta_B)}. $$

A confidence interval or test for this contrast must use that contrast-specific uncertainty. It is not valid to infer a C-versus-B difference merely because one coefficient's individual p-value is below a threshold and another's is above it. A difference between “significant” and “not significant” is not itself a test of the difference.

Worked Example: Changing the Reference Category

Consider a hypothetical four-level covariate with A as reference in a typical-clearance model. Suppose \(TVCL_{\mathrm{pop}}=50\) L/h and the estimated coefficients for B, C, and D are \(-0.10\), \(0.20\), and \(0.35\). Assume these estimates describe the stated model, without implying that their uncertainty is negligible.

Interpret the reference-coded coefficients. The estimated typical clearances are 50 L/h for A, \(50\exp(-0.10)\approx45.2\) L/h for B, \(50\exp(0.20)\approx61.1\) L/h for C, and \(50\exp(0.35)\approx71.0\) L/h for D. The C-versus-B log contrast is \(0.20-(-0.10)=0.30\), so the estimated C-to-B ratio is \(\exp(0.30)\approx1.35\).

Use D as the reference instead. The new baseline typical clearance is the former D value, \(50\exp(0.35)\approx71.0\) L/h. The coefficients for A, B, and C relative to D are, respectively, \(-0.35\), \(-0.10-0.35=-0.45\), and \(0.20-0.35=-0.15\). For example, \(\exp(-0.15)\approx0.861\), the same C-to-D ratio implied by the original coefficients.

The coefficient values and their reference comparisons have changed, but the fitted category-specific predictions have not. The overall null that all four category means on the model's link scale are equal still imposes three independent restrictions, so its joint test has \(df=3\) under either reference choice. Individual contrasts can be chosen to address specific scientific comparisons, with appropriate covariance-based standard errors.

Assumptions, Diagnostics, and Alternatives

A valid joint test depends on more than selecting the correct degrees of freedom. The categorical variable must be encoded as intended, the full model must be identifiable, and the comparison must isolate the effect being tested. In a likelihood-ratio test, the reduced model must be nested within the full model and both fits must use the same observations and likelihood specification. In a Wald test, the coefficient estimates and their covariance matrix must be reliable enough for the quadratic approximation. Neither test repairs a misspecified structural model or an inadequate description of variability.

Useful checks include confirming category counts, checking that indicator columns are not redundant, examining convergence and parameter estimates, and reviewing uncertainty for sparse levels. Very few individuals in a category can lead to unstable estimates or large standard errors. A nearly singular covariance matrix can make a Wald statistic unreliable or impossible to calculate. For a likelihood-ratio test, compare repeated or carefully checked fits if the objective-function difference is small relative to numerical variability. A model that fails to converge reliably does not provide a trustworthy test statistic.

The main alternatives answer related but not identical questions. A likelihood-ratio test compares nested model fits and is often useful for a prespecified block of coefficients. A Wald test uses the full-model estimates and covariance matrix and can be convenient when the fit is stable. A score test evaluates the direction of departure from the null using the reduced model's information; it can be useful when fitting the full model is difficult. In finite samples, or with weak identification, these asymptotic tests may disagree. Their p-values are not interchangeable evidence that one particular category contrast is important.

The omnibus test also has limitations. It tests the specified coding and model form, not every possible relationship between the covariate and outcome. A rejection only indicates that the all-zero coefficient vector is inconsistent with the data under the test assumptions; it does not identify the responsible levels, quantify clinical importance, establish causation, or guarantee predictive value. Follow-up contrasts should be prespecified where possible and interpreted with their uncertainty and any relevant multiplicity plan.

Common Mistakes

  • Testing only one coefficient and calling it the factor test. With \(K\) levels, the overall test concerns \(K-1\) restrictions jointly; one coefficient compares only one level with the reference.
  • Assuming a significant omnibus result means every level differs. It means at least one coefficient is nonzero under the model, not that all pairwise contrasts are nonzero.
  • Adding individual Wald statistics without checking covariance. This is valid only in the special case of zero covariance among the tested estimates. The general joint statistic uses the full covariance matrix.
  • Changing reference categories and treating the changed coefficient p-values as changed overall evidence. Reference choice changes the contrasts represented by individual coefficients; it does not change the global equality hypothesis when tested correctly.
  • Reading a log-scale coefficient as a difference in the original units. In the multiplicative model shown here, exponentiating the coefficient gives a ratio of typical values; the coefficient itself is on the log-ratio scale.
Key takeaway: State the categorical covariate's joint null as a block of \(K-1\) restrictions, use a test with the corresponding degrees of freedom, and keep that omnibus conclusion separate from the interpretation of individual or pairwise contrasts.

Check Your Understanding

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

  1. A five-level factor is represented by reference coding. How many coefficients are tested in its joint null, and what are the degrees of freedom for the usual asymptotic joint test?
  2. A joint test rejects the null for a four-level covariate. What can be concluded, and what cannot be concluded about the pairwise differences?
  3. For a three-level factor with reference A, what coefficient contrast tests C versus B?
  4. A Wald calculation uses only the separate standard errors and ignores covariance between two coefficient estimates. When is that calculation valid?
  5. In a nested-model comparison, the reduced and full objective functions are 950.0 and 944.8, and the full model adds two factor coefficients. Calculate the likelihood-ratio statistic and state its approximate p-value.

Solutions. (1) Four coefficients are tested jointly, so the usual asymptotic reference distribution is \(\chi^2_4\). (2) There is evidence against the null that all category effects are equal under the model; the result does not establish that every pair differs or identify which contrasts differ. (3) The contrast is \(\beta_C-\beta_B\), with its standard error calculated using both variances and their covariance. (4) Summing squared coefficient-to-standard-error ratios gives the joint Wald statistic only when the tested estimates have zero covariance; otherwise use the full covariance matrix. (5) \(LR=950.0-944.8=5.2\), with \(df=2\). Its upper-tail probability is \(\exp(-5.2/2)=\exp(-2.6)\approx0.0743\), so it is not significant at \(\alpha=0.05\). This conclusion assumes comparable nested fits and a suitable chi-square approximation.

Clinical Biostats