Why Predictive Checks Must Respect Dependence
A categorical NLME model describes both response probabilities and, through subject-level random effects, how responses from the same individual may be related. A model can reproduce the overall proportion in each category while missing a covariate-specific trend or producing too few subjects with consistently similar responses across visits. Predictive checks help reveal these mismatches by comparing observed data with data the fitted model could plausibly generate.
The key is to simulate the data at the level the model describes. For repeated outcomes, one random effect is drawn for each subject and used across that subject’s visits; the response vector is then generated according to the fitted model. Treating all simulated responses as independent would erase the model’s dependence structure and give misleading reference distributions for diagnostics.
For example, let \(Y_{ij}\) denote the categorical response for subject \(i\) at visit \(j\), \(x_{ij}\) the covariates, and \(b_i\) the subject-specific random effect. A fitted model supplies category probabilities such as \(P(Y_{ij}=k\mid b_i,x_{ij};\hat\theta)\), where \(\hat\theta\) denotes fitted parameters. A population-level replicate first draws \(b_i^{\mathrm{rep}}\) from the fitted random-effects distribution, then generates the subject’s responses using the model and that same draw at all visits. If the model specifies additional dependence beyond \(b_i\), that dependence must also be used when generating the response vector.
The covariates and schedule are held fixed because the check asks whether the model can reproduce outcomes under the observed design. The outcomes are regenerated. Consequently, a predictive check is not a comparison between the observed data and an unrelated sample with different covariate composition or follow-up.
Building a Predictive Reference Distribution
Choose a diagnostic statistic before examining the simulated results. It might measure the discrepancy in category frequencies, the largest calibration error across covariate strata, or the number of subjects with a particular repeated-response pattern. Compute it once for the observed data, then compute exactly the same statistic for each replicate.
The simulated values \(T^{(1)},\ldots,T^{(B)}\) form a model-based reference distribution. For a discrepancy where larger values indicate worse fit, a common Monte Carlo tail estimate is
Here \(I\{\cdot\}\) equals 1 when the stated condition is true and 0 otherwise. The added 1 avoids reporting a zero tail estimate merely because no simulated value exceeded the observed statistic. This quantity summarizes how often the fitted model’s replicates are at least as discrepant as the observed data; it is not automatically a calibrated frequentist hypothesis-test p-value. In particular, simulations using a single fitted parameter estimate do not fully account for parameter-estimation uncertainty.
A plug-in check uses \(\hat\theta\) throughout and is often useful for graphical and diagnostic assessment. If uncertainty from estimating \(\theta\) matters, an outer parametric bootstrap can generate data under the fitted model, refit the model to each generated data set, and repeat the diagnostic procedure. This is more computationally demanding, and the refit must use the same modeling steps as the original fit.
Category Frequencies: An Overall Check
For a multinomial or other categorical response, compare observed category counts with the model’s expected counts under the observed design. For repeated data, a simple Pearson-type discrepancy can summarize the difference, but its reference distribution should come from model-based replicates rather than an automatic independent-observation chi-square approximation.
where \(O_{sk}\) is the observed number of responses in category \(k\) and stratum \(s\), and \(E_{sk}\) is the corresponding fitted expected count. The strata may be omitted for an overall frequency check. Expected counts are computed by summing fitted category probabilities over the observations in each cell. If an expected count is zero, this particular discrepancy is undefined for that cell; the category or partition must be reconsidered, or another discrepancy statistic used.
Worked Example: Overall Category-Frequency Discrepancy
Hypothetical data. In 80 repeated categorical observations from a group of subjects, suppose responses are summarized in three prespecified covariate strata, each with categories A and B. The table gives observed counts and fitted expected counts.
| Stratum | Category | Observed \(O_{sk}\) | Expected \(E_{sk}\) |
|---|---|---|---|
| 1 | A | 18 | 12 |
| 1 | B | 14 | 16 |
| 2 | A | 8 | 12 |
| 2 | B | 14 | 10 |
| 3 | A | 16 | 18 |
| 3 | B | 10 | 12 |
The observed and expected totals are both 80. The discrepancy is
Thus the observed threshold for this check is \(6.7389\). Suppose 1,000 complete replicated data sets are generated with the same subjects’ covariates and visit schedules, and the same statistic is computed for each. If 73 replicate statistics are at least \(6.7389\), the plus-one Monte Carlo estimate is
This example’s simulated tail area does not indicate an especially extreme overall discrepancy, although it does not prove the model is correct. Crucially, the 80 responses may be dependent within subjects: the reference distribution is obtained from full replicated subject-level data, not from treating the 80 responses as independent in a textbook chi-square test.
Covariate-Stratified Calibration
An overall frequency check can conceal systematic errors that cancel across covariate values. A model might predict too many responses in one part of the covariate range and too few in another. To detect this, define strata using clinically meaningful covariates or prespecified ranges, and compare observed category frequencies with replicate distributions within each stratum.
A useful summary is the maximum absolute standardized deviation across strata. For a binary category, let \(O_s\) be the observed number in that category in stratum \(s\), and let \(\bar O_s^{\mathrm{rep}}\) and \(SD_s^{\mathrm{rep}}\) be the mean and standard deviation of its simulated count across replicates. Define
This statistic measures the largest stratum-level deviation relative to the model’s simulated variability. Its reference distribution must also be simulated: the maximum is affected by the number and dependence of the strata. A value such as 2 is not automatically a standard-normal cutoff.
Worked Example: Checking Calibration Across Covariate Strata
Hypothetical data. Consider three prespecified covariate strata, each containing 20 response occasions, and let the outcome of interest be category A. The observed counts are 1, 7, and 18. Across 2,000 complete model-based replicates, suppose the simulated count means are 4, 9, and 14, and the simulated standard deviations are 2.0, 2.4, and 2.1, respectively.
The stratum-specific standardized deviations are
Therefore \(T_{\mathrm{strat}}=\max(1.500,0.8333,1.905)=1.905\). Suppose 154 of the 2,000 replicate statistics are at least 1.905. Then
The data show an appreciable imbalance across strata, especially the high observed category-A frequency in the third stratum, but this maximum discrepancy is not unusual enough under these simulations to be a decisive warning by itself. The calculation uses the replicate distribution of the maximum, so it accounts for looking across all three strata; interpreting each stratum separately against a fixed cutoff would not do so.
Within-Subject Response Patterns
For repeated categorical outcomes, the arrangement of responses within a subject can be more informative than pooled frequencies. Consider binary responses at three visits. A model might match the total number of responses in category A but still underpredict subjects who show category A at every visit or subjects whose responses alternate. Define a subject-level pattern statistic, such as the number of subjects with the same response at all visits. Compute it on each complete replicate, with each subject’s random effect shared across that subject’s visits.
Worked Example: Repeated-Response Pattern Check
Hypothetical data. Thirty subjects each have three categorical responses. In the observed data, 12 subjects have category A at all three visits, 8 have category B at all three visits, and 10 have mixed responses. Thus \(T_{\mathrm{same}}=12+8=20\) subjects have a constant response across visits.
Suppose 1,000 replicated data sets are generated, drawing one random effect per subject and generating all three responses under the fitted model. Across replicates, the mean number with constant responses is 13.2 and the standard deviation is 3.1. The observed value is
simulated standard deviations above the replicate mean. Suppose 27 of the 1,000 replicate statistics are at least 20. The plus-one tail estimate is
The fitted model appears to generate constant-response subjects less often than observed, warranting closer examination of its subject-level dependence structure. The standardized difference of 2.194 is descriptive; the simulated tail estimate is the relevant comparison for this chosen statistic. Neither calculation treats the 90 responses as independent.
Simulation Procedure, Diagnostics, and Alternatives
The following sequence keeps the comparison aligned with the fitted model and the question being checked.
Choose a statistic that targets the possible failure: category frequencies, calibration by covariate stratum, or a subject-level response pattern. State which direction represents greater discrepancy.
Retain the observed design. Draw random effects at the subject level and generate all responses for each subject according to the fitted model, including any specified dependence structure.
Apply the identical categories, strata, pattern definition, and calculation to the observed data and every replicate.
Inspect the replicate distribution and the observed statistic, then examine which categories, strata, or subjects drive any unusual discrepancy.
Graphical checks are often useful alongside a single statistic. For example, overlay observed category proportions and replicate intervals across covariate strata, or compare the observed number of constant-response subjects with a histogram of replicated values. If a check fails, inspect the model’s fitted probabilities, random-effects distribution, covariate specification, and assumed repeated-response structure. A predictive check identifies a feature the fitted model struggles to reproduce; it does not by itself identify the correct replacement model.
The main alternative is an analytic reference approximation, such as a chi-square distribution for a Pearson statistic. Such approximations rely on conditions that can fail with sparse expected counts, estimated parameters, or repeated responses that are dependent. Simulation offers a reference distribution under the fitted model and observed design, but it is only as credible as that model and the implementation of its simulation. A residual plot may localize errors more directly, while a scalar predictive statistic can summarize a targeted discrepancy; using both is often more informative than relying on either alone.
Assumptions and Common Pitfalls
A predictive check is meaningful only if the simulation matches the model being assessed. It assumes that the fitted model specifies a coherent distribution for the categorical outcomes, random effects, and any within-subject dependence; that covariates and the observation schedule are correctly held fixed; and that the code generates the joint response structure the model claims. The chosen statistic should also correspond to a scientifically relevant feature rather than being selected only because it makes the observed data look unusual.
- Pooling away the feature of interest. Matching overall category totals does not establish covariate-stratified calibration or correct within-subject patterns. Check these features separately when they matter.
- Breaking the dependence structure. Simulating each visit as a fresh independent subject can understate or distort the variability of repeated-pattern statistics. Draw a subject effect once per subject and use it as specified across that subject’s responses.
- Using an automatic chi-square p-value. A Pearson discrepancy can be useful, but its usual reference distribution may be inappropriate for dependent repeated outcomes. Use the empirical distribution from complete replicates for the predictive check.
- Calling the predictive tail area a probability the model is true. It is a comparison between the observed statistic and a fitted-model reference distribution, not the probability that the model is correct.
- Ignoring Monte Carlo error. With a finite number of replicates, a tail estimate is noisy. Increase \(B\) when a more precise tail estimate is needed, especially when few replicates exceed the observed statistic.
The check is limited by its chosen summaries: a model may reproduce the statistics examined and still fail in an unexamined aspect of the data. Plug-in simulations also omit parameter uncertainty unless it is incorporated through an outer procedure. Predictive checks therefore complement model interpretation and other diagnostics; they do not certify a model as universally adequate.
Check Your Understanding
Answer each question, then compare with the brief solutions below.
- Why should a subject’s random effect usually be drawn once, rather than once per visit, in a population-level predictive check?
- A model matches the overall frequency of category A. Give one reason this does not rule out a serious fit problem.
- For a discrepancy statistic, 39 of 999 replicates are at least as large as the observed value. Calculate the plus-one predictive tail estimate.
- Why is a standard independent-observation chi-square reference distribution not automatically appropriate for repeated categorical responses?
Solutions. (1) The same subject effect can induce dependence among that subject’s visits; redrawing it at every visit would change the model’s joint response distribution. (2) Errors can cancel across covariate strata, or the model can misrepresent within-subject patterns while matching pooled totals. (3) \(\hat p_{\mathrm{pred}}=(1+39)/(999+1)=40/1000=0.04000\). (4) Repeated outcomes can be correlated within subjects, and parameter estimation and sparse cells may also invalidate the usual approximation; simulate complete data sets under the fitted model instead.