Skip to content

ADescribe · Guide test 304

Little MCAR test

Tests whether observed missingness patterns are compatible with missing completely at random under the model.

Runs in CodeSplashPython (calls R) example not runR example not run

Do it in CodeSplash

In the app, set it up in Analyze with this method:

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

120
3
0.50

Missingness mechanism

0.20
1.20

How strongly the driver moves the chance of a value going missing.

0.050

Your data

Simulated with a known mechanism
x1x2x3smallest x₁largest x₁ →

Missing 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

d² = 35.00
  1. The reference: how d² varies across samples when H₀ is true.
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = < .001).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

d2=∑jnj(yˉj−μ^oj)⊤Σ^ojoj−1(yˉj−μ^oj) ∼˙ χ∑jpj−p2d^2=\sum_{j}n_j\big(\bar{\mathbf y}_{j}-\hat{\boldsymbol\mu}_{o_j}\big)^\top\hat\Sigma_{o_jo_j}^{-1}\big(\bar{\mathbf y}_{j}-\hat{\boldsymbol\mu}_{o_j}\big)\ \dot\sim\ \chi^2_{\sum_jp_j-p}

With your numbers

d2=35.00,4 patterns,ν=5d^2 = 35.00,\quad 4\text{ patterns},\quad \nu = 5
yˉj\bar{\mathbf y}_j
means of the variables observed in pattern j
μ^, Σ^\hat{\boldsymbol\mu},\ \hat\Sigma
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 H0.

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

D2=∑g=1Gng(xˉg,obs−μ^g,obs)TΣ^g,obs−1(xˉg,obs−μ^g,obs)D^2=\sum_{g=1}^{G}n_g(\bar x_{g,obs}-\widehat\mu_{g,obs})^T\widehat\Sigma_{g,obs}^{-1}(\bar x_{g,obs}-\widehat\mu_{g,obs})

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.

Python · invokes R

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()
R

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

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.