little_test {MCARtest}R Documentation

Carry out Little's test of MCAR.

Description

Carry out Little's test of MCAR.

Usage

little_test(X, type = "mean&cov")

Arguments

X

The dataset with incomplete data, where all the pairs of variables are observed together.

type

Determines the test statistic to use, based on the discussion in Section 6 in Bordino and Berrett (2025). The default option is "mean&cov", and uses the test statistic d^2_{\mathrm{aug}}. When set equal to "cov", implements a test of MCAR based on d^2_{\mathrm{cov}}, while, when set equal to "mean", implements the classical Little's test as defined in Little (1988).

Value

The p-value of Little's test, found by comparing the log likelihood ratio statistic to the chi-squared distribution with the appropriate number of degrees of freedom. Described in Little (1988).

References

Bordino A, Berrett TB (2025). “Tests of Missing Completely At Random based on sample covariance matrices.” Ann. Statist., to appear, arXiv:2401.05256.

Little RJ (1988). “A test of Missing Completely at Random for multivariate data with missing values.” J. Amer. Statist. Assoc., 83, 1198–1202.

Examples

library(MASS)
n = 200

SigmaS=list() #Random 2x2 correlation matrices (necessarily consistent)
for(j in 1:3){
x=runif(2,min=-1,max=1); y=runif(2,min=-1,max=1)
SigmaS[[j]]=cov2cor(x%*%t(x) + y%*%t(y))
}

X1 = mvrnorm(n, c(0,0), SigmaS[[1]])
X2 = mvrnorm(n, c(0,0), SigmaS[[2]])
X3 = mvrnorm(n, c(0,0), SigmaS[[3]])
columns = c("X1","X2","X3")
X = data.frame(matrix(nrow = 3*n, ncol = 3))
X[1:n, c("X1", "X2")] = X1
X[(n+1):(2*n), c("X2", "X3")] = X2
X[(2*n+1):(3*n), c("X1", "X3")] = X3
X = as.matrix(X)

little_test(X)
little_test(X, type = "mean&cov")
little_test(X, type = "mean")

[Package MCARtest version 1.3 Index]