ADescribe · Guide test 304
Little MCAR test
Tests whether observed missingness patterns are compatible with missing completely at random under the model.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Missing-data patterns and MCAR tests — How much is missing, in which patterns — and is it missing completely at random?
In Missing-data patterns and MCAR tests, choose MCAR tests = All three or choose MCAR tests = Little's χ² test.
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Little MCAR test
Missingness mechanism
How strongly the driver moves the chance of a value going missing.
Your data
Simulated with a known mechanismMissing per variable: x1 0 · x2 34 · x3 31. Mean x₁ where a value is missing: 0.44; in complete rows: −0.33. Under MCAR the two agree up to chance.
If H₀ were true
- The reference: how d² varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = < .001).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- means of the variables observed in pattern j
- EM estimates under multivariate normality, restricted to those variables
The verdict
d²(5) = 35.00, p < .001
p ≤ α = .050: reject H₀
Rejection says the data are not MCAR; failing to reject does not show MCAR, and MNAR can pass unnoticed. It leans on multivariate normality.
- Statistic
- 35.003
- p-value
- 0.0000
Little MCAR test on 120 rows × 3 variables, 65 values missing (MAR): d²(5) = 35.00, p < .001. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: observed means are compatible with missing completely at random under the multivariate model.
Assumptions
Independent observations, identifiable common mean/covariance and adequate pattern sizes; classical chi square calibration uses a multivariate normal model.
Formula
Parameters and notation
g indexes missingness patterns; use observed-variable submatrices of global ML/EM estimates. df=Σg pg−p, with pg observed dimensions per pattern and p total variables.
Structure of the method
Group rows by missingness pattern, estimate a common multivariate mean/covariance using observed-data likelihood, and compare each pattern’s observed means with their fitted components. The statistic aggregates Mahalanobis discrepancies over observed-variable subspaces and uses a regularity-dependent chi-square reference.
Estimated and nuisance parameters
Estimated nuisance quantities include the global mean, covariance and pattern-specific observed means. Pattern counts and observed dimensions determine the statistic and nominal degrees of freedom. Missing values are not filled once and then treated as genuine observations to justify ordinary complete-data calibration.
Settings and design choices
Specify variables, transformations, pattern handling and treatment of nonnumeric columns before testing. Check covariance identifiability and numerical convergence. Removing sparse patterns or collinear variables changes the tested dataset and should be documented, rather than hidden as an implementation convenience.
Fitting and adaptation
Fit the observed-data model with a validated ML/EM implementation and inspect convergence/singularity diagnostics. Recalibration for nonnormal or small-pattern settings requires a justified procedure, not neural fine-tuning. If simulating a reference, repeat missingness pattern construction and nuisance fitting under the proposed null.
Sensitivity and robustness
Small patterns, many variables, nonnormal tails and covariance misspecification can produce misleading chi-square calibration. Nonrejection does not prove MCAR; rejection cannot discriminate MAR from MNAR. Report the analyzed patterns, variable set and model assumptions, and complement the test with missingness diagnostics and scientifically motivated sensitivity analyses.
How to use and calibrate
Use χ²df under regularity and inspect small/singular patterns. A rejection is evidence against model-compatible MCAR.
Example application
Assess whether missingness patterns have different observed means.
Interpretation and pitfalls
Watch out
Nonsignificance cannot prove MCAR, and rejecting MCAR does not distinguish MAR from MNAR. Distributional misspecification can cause rejection.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Little’s MCAR test on numeric variables; model-based multivariate-normal likelihood and identifiable missingness patterns are required. Failure to reject does not establish MCAR.
Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: naniar
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
X<-matrix(rnorm(240*4),240,4);X[1:60,1]<-NA;X[61:120,2]<-NA;colnames(X)<-paste0("v",1:4)
print(naniar::mcar_test(as.data.frame(X)))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Not run — Syntax checked; runtime not verified in the final environment · needs naniar
set.seed(2026)
X<-matrix(rnorm(240*4),240,4);X[1:60,1]<-NA;X[61:120,2]<-NA;colnames(X)<-paste0("v",1:4)
print(naniar::mcar_test(as.data.frame(X)))
Sources
- naniar — naniar · mcar_testAuthor documentation/source reviewed: naniar 1.1.0.search.r-project.org
- mcar_testsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 304, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT304.