Description Usage Arguments Value References Examples
Linear correlation: Pearson's linear correlation test.
1 | cor2(x, y, S, suffStat)
|
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. |
the p-value of the test.
Marco Scutari (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1-22.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.