mixMItest {micd}R Documentation

Likelihood Ratio Test for (Conditional) Independence between Mixed Variables after Multiple Imputation

Description

A modified version of mixCItest, to be used within pcalg::skeleton, pcalg::pc or pcalg::fci when multiply imputed data sets are available.

Usage

mixMItest(x, y, S = NULL, suffStat, moreOutput = FALSE)

Arguments

x, y, S

(integer) position of variable X, Y and set of variables S, respectively, in suffStat. It is tested whether X and Y are conditionally independent given the subset S of the remaining variables.

suffStat

A list of data.frames containing the multiply imputed data sets. Usually obtained from a mice::mids object using mice::complete with argument action="all". Discrete variables must be coded as factors.

moreOutput

(only for mixed of discrete variables) If TRUE, the test statistic, its main components and the degrees of freedom are returned in addition to the p-value. Defaults to FALSE.

Details

See mixCItest for details on the assumptions of the Conditional Gaussian likelihood ratio test. CGtestMI applies this test to each data.frame in suffStat, then combines the results using the rules in Meng & Rubin (1992).

Value

A p-value. If moreOutput=TRUE, the test statistic, its main components and the degrees of freedom are returned as well.

Author(s)

Janine Witte

References

Meng X.-L., Rubin D.B. (1992): Performing likelihood ratio tests with multiply imputed data sets. Biometrika 79(1):103-111.

Examples


## load data (numeric and factor variables)
data(toenail2)
dat <- toenail2[1:1000, ]

## delete some observations
set.seed(123)
dat[sample(1000, 20), 2] <- NA
dat[sample(1000, 30), 4] <- NA

## impute missing values using random forests (because of run time we just impute 2 chains)
imp <- mice(dat, method = "rf", m = 2, printFlag = FALSE)

## analyse data
# complete data:
mixCItest(2, 3, 5, suffStat = toenail2[1:1000, ])
# multiple imputation:
suffMI <- complete(imp, action = "all")
mixMItest(2, 3, 5, suffStat =  suffMI)
# test-wise deletion:
mixCItwd(2, 3, 5, suffStat = dat)
# list-wise deletion:
sufflwd <- dat[complete.cases(dat), ]
mixCItest(2, 3, 5, suffStat = sufflwd)

## use mixMItest within pcalg::pc

pc.fit <- pc(suffStat =  suffMI, indepTest = mixMItest, alpha = 0.01, p = 5)
pc.fit



[Package micd version 1.1.1 Index]