| disCItwd | R Documentation |
A wrapper for pcalg::disCItest, to be used within
pcalg::skeleton, pcalg::pc or
pcalg::fci when the data contain missing values.
Observations where at least one of the variables involved in the test is
missing are deleted prior to performing the test (test-wise deletion).
disCItwd(x, y, S = NULL, suffStat)
x, y, S |
(Integer) position of variable X, Y and set of variables S,
respectively, in |
suffStat |
A list with three elements, |
See disCItest for details on the G square test. Test-wise deletion
is valid if missingness does not jointly depend on X and Y.
A p-value.
pcalg::disCItest for complete data, disMItest
for multiply imputed data
## load data (200 observations)
data(gmD)
dat <- gmD$x[1:1000,]
## delete some observations of X2 and X3
set.seed(123)
dat[sample(1:1000, 50), 2] <- NA
dat[sample(1:1000, 50), 3] <- NA
## analyse incomplete data
# test-wise deletion ==========
sufftwd <- getSuff(dat, test = "disCItwd")
disCItwd(1, 3, NULL, suffStat = sufftwd)
# list-wise deletion ==========
dat2 <- dat[complete.cases(dat), ]
suffStat2 <- getSuff(dat2, test = "disCItest", adaptDF = FALSE)
disCItest(1, 3, NULL, suffStat = suffStat2)
## use disCItwd within pcalg::pc ==========
pc.fit <- pc(suffStat = sufftwd, indepTest = disCItwd, alpha = 0.1, p = 5)
pc.fit
if (requireNamespace("Rgraphviz", quietly = TRUE))
plot(pc.fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.