Learn R Programming

pcalg (version 1.0-0)

gaussCItest: Test for (conditional) independence for gaussian data

Description

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

Usage

gaussCItest(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 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 is returned.

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, conditional independence test on discrete variables and conditional independence test on 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