cor2: The Pearson's correlation test

Description Usage Arguments Value References Examples

Description

Linear correlation: Pearson's linear correlation test.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
##########################################
## 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)

ParallelPC documentation built on May 2, 2019, 9:14 a.m.

Related to cor2 in ParallelPC...