Learn R Programming

naniar (version 1.0.0)

mcar_test: Little's missing completely at random (MCAR) test

Description

Use Little's (1988) test statistic to assess if data is missing completely at random (MCAR). The null hypothesis in this test is that the data is MCAR, and the test statistic is a chi-squared value. The example below shows the output of mcar_test(airquality). Given the high statistic value and low p-value, we can conclude the airquality data is not missing completely at random.

Usage

mcar_test(data)

Value

A tibble::tibble() with one row and four columns:

statistic

Chi-squared statistic for Little's test

df

Degrees of freedom used for chi-squared statistic

p.value

P-value for the chi-squared statistic

missing.patterns

Number of missing data patterns in the data

Arguments

data

A data frame

Author

Andrew Heiss, andrew@andrewheiss.com

References

Little, Roderick J. A. 1988. "A Test of Missing Completely at Random for Multivariate Data with Missing Values." Journal of the American Statistical Association 83 (404): 1198--1202. tools:::Rd_expr_doi("10.1080/01621459.1988.10478722").

Examples

Run this code
mcar_test(airquality)
mcar_test(oceanbuoys)

# If there are non-numeric columns, there will be a warning
mcar_test(riskfactors)

Run the code above in your browser using DataLab