cor2 {ParallelPC}R Documentation

The Pearson's correlation test

Description

Linear correlation: Pearson's linear correlation test.

Usage

cor2(x, y, S, suffStat)

Arguments

x, y, S

It is tested, whether x and y are conditionally independent given the subset S of the remaining nodes. x, y, S all are integers, corresponding to variable or node numbers.

suffStat

the dataset with rows are samples and columns are variables.

Value

the p-value of the test.

References

Marco Scutari (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1-22.

Examples

##########################################
## Using cor2 as a conditional independence test
##########################################
library(pcalg)
library(bnlearn)
data("gmG")
suffStat<-gmG$x
cor2(1,2,3,suffStat)
##Use cor2 with a causal discovery algorithm, e.g. PC
pc_stable(gmG$x, indepTest=cor2, p=ncol(gmG$x), alpha=0.01)

[Package ParallelPC version 1.2 Index]