Last chance! 50% off unlimited learning
Sale ends in
disCItest()
is a wrapper of gSquareDis()
, to be easily
used in skeleton
, pc
and fci
.
gSquareDis(x, y, S, dm, nlev, adaptDF = FALSE, n.min = 10*df, verbose = FALSE)
disCItest (x, y, S, suffStat)
dm
.nrow(dm)
) for which the G^2 test is computed; for smaller
$n$, independence is assumed ($G^2 := 1$) with a warning. The
default is $10 m$, where $m$ is the degrees of freedom
assuming no structural zeros, here, the product of all the number of
levels (nlev[x]-1) * (nlev[y]-1) * prod(nlev[S])
.list
with three elements, "dm"
,
"nlev"
, "adaptDF"
; each corresponding to the above
arguments of gSquareDis()
.NULL
). If only binary
variables are involved, gSquareBin
is a specialized
(a bit more efficient) alternative to gSquareDis()
.
gSquareBin
for a (conditional) independence test
for binary variables. dsepTest
, gaussCItest
and
binCItest
for similar functions for a d-separation
oracle, a conditional independence test for gaussian variables and a
conditional independence test for binary variables, respectively.
## Simulate data
n <- 100
set.seed(123)
x <- sample(0:2, n, TRUE) ## three levels
y <- sample(0:3, n, TRUE) ## four levels
z <- sample(0:1, n, TRUE) ## two levels
dat <- cbind(x,y,z)
## Analyze data
gSquareDis(1,3, S=2, dat, nlev = c(3,4,2)) # but nlev is optional:
gSquareDis(1,3, S=2, dat, verbose=TRUE, adaptDF=TRUE)
## with too little data, gives a warning (and p-value 1):
gSquareDis(1,3, S=2, dat[1:60,], nlev = c(3,4,2))
suffStat <- list(dm = dat, nlev = c(3,4,2), adaptDF = FALSE)
disCItest(1,3,2,suffStat)
Run the code above in your browser using DataLab