Learn R Programming

pcalg (version 1.1-4)

binCItest: Test for (conditional) independence for binary data

Description

This function tests for (condtitional) independence between binary random variables. The function is written, so that it can be easily used in skeleton, pc and fci.

Usage

binCItest(x, y, S, suffStat)

Arguments

x
Position of variable X in the adjacency matrix
y
Position of variable Y in the adjacency matrix
S
Position of conditioning variables in the adjacency matrix
suffStat
A list with two elements: (1) Element "dm" containing the data matrix (columns are variables, rows are samples) and (2) element "adaptDF" as a boolean variable indicating whether to lower the degrees of freedom by one for each zero count.

Value

  • The p-value of the test.

Details

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

See Also

dsepTest, gaussCItest and disCItest for similar functions for a d-separation oracle, a conditional independence test for gaussian variables and a conditional independence test for discrete variables, respectively.

Examples

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

suffStat <- list(dm = dat, adaptDF = FALSE)
binCItest(1,3,2,suffStat)

Run the code above in your browser using DataLab