Learn R Programming

pcalg (version 1.1-4)

gaussCItest: Test for (conditional) independence for gaussian data

Description

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

Usage

gaussCItest(x, y, S, suffStat)

Arguments

x
Position of variable X in adjacency matrix
y
Position of variable Y in adjacency matrix
S
Position of the conditioning variables in the adjacency matrix
suffStat
A list with two elements: (1) Element "C" containing the correlation matrix of the data and (2) element "n" containing the sample size.

Value

  • The p-value of the test.

Details

The Fisher z transformation is used. See the help on zStat for details.

See Also

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

Examples

Run this code
## simulate data: x -> y -> z
set.seed(29)
x <- rnorm(100)
y <- 3*x + rnorm(100)
z <- 2*y + rnorm(100)
dat <- cbind(x,y,z)

## analyze data
suffStat <- list(C = cor(dat), n = nrow(dat))
gaussCItest(1,3,NULL,suffStat) ## dependent
gaussCItest(1,3,2,suffStat) ## independent

Run the code above in your browser using DataLab