Exact conditional calibration of residual processes in linear mixed models
Jakob Peterlin
stat.ME
Nov 30, 2026 · v1
TL;DR
Every numbered statement of the paper and its supplement is stated and proved as a Lean 4 theorem using Mathlib, with the project included in the supplement.
Abstract
A cumulative residual test checks a fitted linear mixed model by summing residuals in the order of a fitted prediction and comparing their path with simulated paths. Large-sample calibrations can fail when small samples, short series or many fixed effects leave few residual degrees of freedom. We give a calibration that is exact at every sample size. Under independent homoscedastic Gaussian errors, the residual projected off all fixed and random design columns has a uniform direction, given its length and the response component inside the design span, and (restricted) maximum likelihood fits depend on the response only through these two summaries. Rotating the projected residual reproduces the conditional law of the observed path. The test is exact for nested or crossed factors, few groups, singular covariance estimates and any random-effect distribution, and one set of rotations calibrates a joint test over orderings and smoothing scales. The whitened process is covered once every rotation retains its fitted offset. Departures inside that span are invisible; outside it, a finite-sample bound gives power. In simulations with 6 to 1261 residual degrees of freedom the exact test held its 5% level. Gaussian draws rejected 0.5% of null samples with 6 and 4% with 25, and up to 36% when many fixed effects biased a maximum likelihood variance estimate; below 50 they lost 1 to 6 percentage points of power. In two small classical studies, of gasoline yield and rat growth, exact $p$-values were two to eight times smaller than with Gaussian draws.
Problem
Cumulative residual tests for linear mixed models are usually calibrated by large-sample Gaussian draws. These can fail when few residual degrees of freedom remain, for example with small samples, short series or many fixed effects.
Approach
Under Gaussian errors, the residual projected off all fixed and random design columns has a uniform direction given its length and the in-span response component. ML and REML fits depend on the data only through these two summaries. Rotating the projected residual therefore reproduces the conditional law of the observed path and gives exact tests, including a joint test over orderings and scales. All numbered results are formalised in Lean 4 with Mathlib.
Results
In simulations with 6 to 1261 residual degrees of freedom, the exact test held its 5% level. Gaussian draws were conservative at small residual dimension, and with many fixed effects and an ML variance estimate they rejected up to 36% of null samples. In two classical studies, exact p-values were two to eight times smaller than those from Gaussian draws.
| Model | n | r | Rotations O | Gaussian draws O (residual scale) |
|---|
| Gasoline yield | 32 | 21 | 0.006 | 0.013 |
| Rat linear, thiouracil | 50 | 30 | 0.002 | 0.005 |
| Rat linear, thyroxin | 35 | 21 | 0.0004 | 0.003 |
Selected CvM p-values (ML fits): exact rotations vs Gaussian draws for O