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

View source: R/LittleMCAR_test.R

LittleMCAR_testR Documentation

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. In the mlest() function of the mvnmle package, the correct statistics could not be calculated because the solution of ML estimation may not converge with the default value. Using a modified version of the mlest2() function, an algorithm is used to perform ML estimation until the solution converges.

Usage

LittleMCAR_test(data, ...)

Arguments

data

A data frame

...

Arguments passed on to mlest2

max_iterlim

Numeric. Upper limit of the number of iterations to avoid infinite loops.

iterlim

a positive integer specifying the maximum number of iterations to be performed before the program is terminated.

Details

If stop.code is 4, the solution of maximum likelihood estimation has not converged at the upper limit of the number of calculations set by max_iterlim; change max_iterlim and recalculate with an increased upper limit.

Value

A list with class "htest" containing the following components:

statistic

Chi-square value.

parameter

Degrees of freedom used for chi-square.

p.value

the p-value for the test.

method

a character string indicating the type of test performed.

data.name

a character string giving the name of the data.

missing.patterns

Number of missing data patterns.

amount.missing

Amount and percent of mssing data.

data

The data, organized my missing data patterns.

stop.code

The stop code returned by nlm.

iterations

The number of iterations used by nlm.

Note

Code is adapted from mcar_test in naniar package.

See Also

mlest2

Examples

LittleMCAR_test(airquality)


indenkun/infun documentation built on April 17, 2025, 2:52 p.m.