disMItest {micd}R Documentation

G square Test for (Conditional) Independence between Discrete Variables after Multiple Imputation

Description

A modified version of pcalg::disCItest, to be used within pcalg::skeleton, pcalg::pc or pcalg::fci when multiply imputed data sets are available. Note that in contrast to pcalg::disCItest, the variables must here be coded as factors.

Usage

disMItest(x, y, S = NULL, suffStat)

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". All variables must be coded as factors. NO warning is issued if the variables are not coded as factors!

Details

See pcalg::disCItest for details on the G square test. disMItest applies this test to each data.frame in suffStat, then combines the results using the rules in Meng & Rubin (1992). Degrees of freedom are never adapted, and there is no minimum required sample size, while pcalg::disCItest requires 10*df observations and otherwise returns a p-value of 1.

Value

A p-value.

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.

See Also

pcalg::disCItest for complete data, disCItwd for test-wise deletion

Examples


## load data (200 observations) and factorise
data(gmD)
dat <- gmD$x[1:1000, ]
dat[] <- lapply(dat, as.factor)

## delete some observations of X2 and X3
set.seed(123)
dat[sample(1:1000, 40), 2] <- NA
dat[sample(1:1000, 40), 3] <- NA

## impute missing values under model with two-way interactions
form <- make.formulas.saturated(dat, d = 2)
imp <- mice::mice(dat, formulas = form, printFlag = FALSE)
imp <- mice::complete(imp, action = "all")

## analyse imputed data
disMItest(1, 3, NULL, suffStat = imp)

## use disMItest within pcalg::pc
pc.fit <- pc(suffStat = imp, indepTest = disMItest, alpha = 0.01, p = 5)
pc.fit

if(require("Rgraphviz", character.only = TRUE, quietly = TRUE)){
plot(pc.fit)
}


[Package micd version 1.1.1 Index]