mcar {missr}R Documentation

Little's missing completely at random (MCAR) test

Description

[Stable] mcar() performs Little's MCAR test to test for MCAR. The null hypothesis is that the data is MCAR.

Usage

mcar(data, debug = FALSE)

Arguments

data

A data frame.

debug

A logical value used only for unit testing.

Details

This function reproduces the d^2 statistic in equation (5) from [1]. This statistic is used to test for MCAR. Comments reference variables from vignette("background") (in brackets) to improve readability and traceability.

Value

A tibble::tibble():

statistic

The d^2 statistic

degrees_freedom

Degrees of freedom of chi-squared distribution

p_val

P-value of the test

missing_patterns

Number of missing patterns

Note

Code is adapted from mcar_test() from the naniar package using base R instead of the tidyverse.

References

[1] Little RJA. A Test of Missing Completely at Random for Multivariate Data with Missing Values. Journal of the American Statistical Association. 1988;83(404):1198-202.

Examples

mcar(pollutionlevels)


[Package missr version 1.0.1 Index]