disMItest | R Documentation |
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.
disMItest(x, y, S = NULL, suffStat)
x, y, S |
(Integer) position of variable X, Y and set of variables S,
respectively, in |
suffStat |
A list of |
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.
A p-value.
Janine Witte
Meng X.-L., Rubin D.B. (1992): Performing likelihood ratio tests with multiply imputed data sets. Biometrika 79(1):103-111.
pcalg::disCItest
for complete data,
disCItwd
for test-wise deletion
## 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) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.