Learn R Programming

pcalg (version 1.0-0)

disCItest: Test for (conditional) independence for discrete data

Description

This function tests for (condtitional) independence between discrete random variables. The function was organized in a way, so that it can easily be used in skeleton, pc, fci.

Usage

disCItest(x, y, S, suffStat)

Arguments

x
Position of node X in adjacency matrix
y
Position of node Y in adjacency matrix
S
Position of set of nodes in adjacency matrix on which is conditioned
suffStat
A list with three elements: (1) Element "dm" containing the data matrix (columns are variables, rows are samples), (2) element "nlev" containing a vector with numbers of levels for each variable and (3) element "adaptDF" as a boolean variable

Value

  • The p-value of the test is returned.

Details

This function is based on gSquareDis; see its help file for details.

See Also

dsepTest, gaussCItest and binCItest for similar functions for a d-separation oracle, conditional independence test on gaussian variables and conditional independence test on binary variables, respectively.

Examples

Run this code
## Simulate data
set.seed(123)
x <- sample(1:3,100,TRUE)
y <- sample(1:4,100,TRUE)
z <- sample(1:2,100,TRUE)
dat <- cbind(x,y,z)

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