Tutorials › Nonlinear Mixed-Effects Models (NLME) › Ensuring Fair Comparisons During Covariate Selection

Covariate Model Building Strategies · Tutorial 478 of 797

Ensuring Fair Comparisons During Covariate Selection

Learn a reproducible workflow for comparing covariate models without confusing changes in data, estimation, or optimization with evidence for a covariate.

Intermediate 11 min read

What You'll Learn

  • Identify which data and likelihood settings must match for a valid model comparison.
  • Explain why all retained parameters must be re-estimated after a covariate change.
  • Calculate and interpret a likelihood-ratio statistic for properly fitted nested models.
  • Recognize convergence and optimization results that make an apparent comparison unreliable.
  • Distinguish likelihood-ratio comparisons from information-criterion comparisons.

Why Fair Comparisons Matter

Covariate selection asks whether a candidate model describes the data better in a way that justifies its added complexity. A numerical difference between two objective functions does not answer that question by itself. The difference is interpretable only when it comes from the model change of interest, rather than from a change in which observations were analyzed, how the likelihood was evaluated, or whether one fit stopped at a poorer optimum.

This issue is especially important in nonlinear mixed-effects models. A model’s likelihood depends on its fixed effects, random-effects distribution and covariance parameters, residual model, and the individual data records included in the analysis. Optimization is also more demanding than in many simple regression models. A fair comparison therefore requires more than running two fits and subtracting their reported objective values.

Definition: A fair model comparison evaluates candidate models using the same analysis records and the same likelihood definition and estimation settings, with each model successfully optimized and all of its free parameters re-estimated. For a comparison intended to isolate a covariate effect, the models should differ in that covariate specification and any explicitly planned associated parameters, while other modeling choices remain fixed.

What Must Be Held Constant

For subject \(i\), let \(y_i\) denote the observed data and let \(f_i(y_i\mid\theta)\) be its marginal likelihood contribution after accounting for the subject-specific random effects. The total log likelihood is \( \ell(\theta)=\sum_{i=1}^{N}\log f_i(y_i\mid\theta) \). Here \(\theta\) collects all estimated parameters, including population parameters, random-effects covariance parameters, and residual parameters. In practice, a software package may evaluate or approximate this likelihood using a specified estimation method. The method and its relevant settings must be consistent across the candidate fits.

  • Same records and likelihood contributions. Use the same subjects and observations, with the same handling of missing data, censoring, event records, and likelihood contributions. A covariate model that silently removes records with missing covariate values is not directly comparable by a likelihood-ratio test with a model fitted to more records.
  • Same likelihood and estimation settings. Keep the estimation method, likelihood approximation, data handling, and relevant numerical settings consistent. If the software reports an objective such as \(-2\ell\), verify that it represents the same criterion in both fits.
  • Same non-covariate structure. Keep the structural model, random-effects structure, residual model, and other covariate relationships fixed when the intended question concerns one covariate change. If several features change, the comparison cannot attribute the difference to just one of them.
  • Successful optimization of each model. Check convergence messages and available diagnostics. A converged status is useful but not sufficient: inspect gradients, parameter estimates, standard errors, and whether estimated covariance matrices are admissible. Implausible estimates or unstable results across reasonable initial values can signal that the reported fit is not a reliable optimum.

The parameters must be re-estimated in every candidate model. Suppose a covariate is removed. It is not fair to hold the other population and variance parameters at their values from the larger model: those values were estimated under a different model, and the best-fitting values may change when the covariate is absent. The same principle applies when a covariate is added. Refit the full candidate model rather than evaluating it with old parameter estimates.

Likelihood-Ratio Comparisons and Their Conditions

For nested models fitted by maximum likelihood to the same data under the same likelihood evaluation, let \(\ell_R\) be the maximized log likelihood for the reduced model and \(\ell_F\) the maximized log likelihood for the full model. The likelihood-ratio statistic is \( \Lambda=2(\ell_F-\ell_R) \). Equivalently, if the reported objective is \(-2\ell\), subtract the full-model objective from the reduced-model objective. Under the null hypothesis that the added parameters are zero, and under regularity conditions, \(\Lambda\) is approximately distributed as chi-square with degrees of freedom equal to the number of additional free parameters.

The comparison requires nested models: every parameter configuration allowed by the reduced model must also be allowed by the full model. The chi-square approximation also relies on regularity conditions, including an interior null value and an identifiable model. A covariate effect tested at zero often satisfies this condition, but tests involving variance components at a boundary, or poorly identified parameters, may not. The standard chi-square reference distribution should not be used automatically in such cases.

Justification: Because the reduced model is contained within the full model, maximizing the same likelihood over the larger parameter space cannot produce a smaller maximum. Thus \(\ell_F\geq\ell_R\) and \(\Lambda\geq0\), up to numerical error. Under the null and regularity conditions, the likelihood-ratio statistic has the stated asymptotic chi-square distribution. If a fitted full model has a materially lower log likelihood than its reduced counterpart, optimization or implementation should be investigated before interpreting the statistic.

A likelihood-ratio test addresses a specified nested comparison; it does not establish that the selected covariate model is uniquely correct or that the covariate has a causal effect. Its p-value is calculated under the null model and the test assumptions. For an ongoing stepwise search, it is also conditional on the comparison being made; it does not account automatically for all the searches already performed.

Worked Example: Testing One Covariate After Comparable Fits

Hypothetical example. Two models use the same 120 subjects, likelihood approximation, estimation settings, structural model, random-effects structure, and residual model. The full model adds one fixed effect for a continuous covariate. Both models converged, and all parameters were re-estimated. The reduced model has objective \(-2\ell_R=1280.0\); the full model has objective \(-2\ell_F=1275.4\).

The models are nested and differ by one estimated covariate-effect parameter, so \(df=1\). The statistic is \( \Lambda=(-2\ell_R)-(-2\ell_F)=1280.0-1275.4=4.60 \).

Under the null and the regularity conditions, compare this statistic with a chi-square distribution with 1 degree of freedom. The upper-tail p-value is \(P(\chi^2_1\geq4.60)=0.03197\). At \(\alpha=0.05\), this is evidence against the null of no covariate effect in this specified comparison. It is not a 3.197% probability that the null is true. The result supports improved likelihood for the full model, but does not by itself establish clinical importance or validate the model for prediction.

Re-estimation and Optimization Checks

Even when the data and settings match, a comparison can fail if one model is not adequately optimized. A failed or shallow optimization may make the log likelihood too low, exaggerating or concealing the difference between candidate models. Use consistent convergence criteria and estimation settings, and retain enough fit information to verify what the software actually estimated.

1
Define the comparison.
State the reduced and full model, the covariate change being tested, and whether the models are nested.
2
Align the analysis.
Confirm that both fits use identical records, likelihood contributions, model components unrelated to the test, and estimation settings.
3
Refit and inspect.
Estimate all free parameters separately in each model. Review convergence messages, gradients, parameter plausibility, uncertainty estimates, and covariance-matrix validity.
4
Calculate and qualify the result.
For a valid nested comparison, calculate the likelihood-ratio statistic and use its appropriate reference distribution. Record any limitation that affects the interpretation.

If a model does not converge, do not treat its reported objective as an ordinary comparable maximum. Review the model specification and data, use sensible alternative initial values where appropriate, and refit under the same settings. If estimates change substantially across starts, or a parameter is weakly identified, the fit may not support a dependable selection decision. Changes in objective-function evaluation caused by a different estimation method or approximation also make a raw subtraction difficult to interpret as a likelihood-ratio statistic.

Worked Example: Different Analysis Records Invalidate a Direct Test

Hypothetical example. A reduced model is fitted to 120 subjects, with objective \(-2\ell_R=1280.0\). A full model that includes a candidate covariate is fitted to only 112 subjects because eight subjects lack that covariate; its objective is \(-2\ell_F=1190.0\). The full model’s smaller objective does not show that the covariate improved fit: the two objectives summarize likelihoods over different sets of subjects.

The apparent subtraction would be \(1280.0-1190.0=90.0\), but this is not a valid likelihood-ratio statistic for the covariate effect. Its reference distribution does not repair the mismatch in records. A fair comparison for the covariate question would fit both models to the same 112 subjects, using identical settings and re-estimating all parameters in both. Alternatively, a model and data strategy that legitimately retains all subjects would need to be specified and applied consistently. The resulting comparison would answer a question about the common analysis set or the consistently defined likelihood, not automatically the original 120-subject fit.

The check is substantive, not cosmetic: the number and identity of subjects, as well as the observations contributing to the likelihood, must agree before a likelihood difference is interpreted.

Information Criteria and Other Comparisons

Not every useful comparison is a likelihood-ratio test. For models fitted to the same data with comparable likelihood definitions, the Akaike information criterion is \( \mathrm{AIC}=-2\ell+2k \), where \(k\) is the number of estimated parameters. AIC trades fit against a parameter-count penalty and can compare nonnested models. Lower AIC indicates the preferred trade-off among the candidates considered; it is not a significance test and does not prove that the selected model is true. The same fairness requirements about data, likelihood evaluation, and reliable optimization still apply.

Worked Example: AIC Can Prefer the Simpler Candidate

Hypothetical example. Two converged models use the same data and likelihood evaluation. Model A has \(-2\ell_A=1275.4\) and \(k_A=8\) estimated parameters. Model B has \(-2\ell_B=1273.8\) and \(k_B=10\). Model B fits better by raw likelihood because its objective is smaller, but it uses two additional parameters.

For Model A, \(\mathrm{AIC}_A=1275.4+2(8)=1291.4\). For Model B, \(\mathrm{AIC}_B=1273.8+2(10)=1293.8\). The AIC difference is \(1293.8-1291.4=2.40\), favoring Model A by this criterion. This does not contradict the better raw fit of Model B; AIC accounts for its extra parameters. Nor is this an LRT conclusion, particularly if the models are not nested.

Wald statistics, screening approaches, and visual or predictive assessments answer different questions and may help assess a candidate covariate from other perspectives. They do not make an unfair likelihood comparison fair. In particular, a Wald test from one fitted model is not a substitute for refitting and evaluating both models when the intended evidence is a likelihood difference.

Common Pitfalls and Limitations

  • Comparing fits on different records. A lower objective may simply reflect a different collection of likelihood contributions. Align the analysis set before comparing.
  • Reusing parameter estimates. Holding other parameters fixed after changing the covariate model fails to compare the best-fitting versions of the candidates. Re-estimate every free parameter in each model.
  • Trusting a convergence label alone. A nominally converged fit can still have poor gradients, implausible estimates, or an invalid covariance estimate. Inspect diagnostics and investigate sensitivity to starting values.
  • Subtracting incompatible objective values. Different estimation methods or likelihood approximations may yield different reported criteria. Confirm that the objective has the same meaning and settings in both fits.
  • Using the chi-square reference automatically. The standard LRT approximation depends on nesting and regularity. Boundary parameters or weak identification can invalidate the usual reference distribution.
  • Interpreting a selected model as definitive. A valid comparison supports a limited statement about the candidate models and data. It does not establish causal effect, clinical relevance, or certainty that the selected model is best among all possible models.

Fair comparisons reduce avoidable artifacts in covariate selection, but they do not eliminate uncertainty from model search or guarantee that the likelihood approximation is adequate. The conclusion should therefore describe the particular models, data, and estimation conditions used.

Check Your Understanding

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

  1. Why must both models use the same subjects for an ordinary likelihood-ratio comparison?
  2. A nested full model has a lower log likelihood than the reduced model by 0.3 units after fitting. What should be checked before interpreting a test statistic?
  3. When a covariate is removed from a model, why should the remaining parameters be re-estimated?
  4. Two nonnested models use the same data and likelihood. Name one criterion that can compare them and state what it does not establish.
  5. A full model adds one covariate parameter and gives an LRT statistic of 4.60. What are the degrees of freedom, and what is the p-value to five significant figures?

Solutions. (1) The likelihoods must summarize the same observations and contributions; otherwise, their difference can reflect a changed data set rather than the model change. (2) Check whether the models are truly nested and whether both fits used the same likelihood and estimation settings; inspect convergence, gradients, and optimization, because a full model optimized over a larger space should not have a meaningfully worse maximum. (3) The best-fitting values of retained parameters can change under the altered model, so each candidate must be optimized on its own. (4) AIC can compare such candidates when their likelihood evaluations and data are comparable; it does not provide a significance test or prove either model true. (5) The difference is one parameter, so \(df=1\); \(P(\chi^2_1\geq4.60)=0.03197\).