| gausCorScore | R Documentation |
The score is intended to be used with score-based causal discovery algorithms from the pcalg package. It is identical to the pcalg::GaussL0penObsScore, except that it takes in a correlation matrix instead of the full data set.
gausCorScore(cormat, n, p = NULL, lambda = NULL, ...)
cormat |
A correlation matrix. Needs to be symmetric. |
n |
The number of observations in the dataset that the correlation matrix was computed from. |
p |
The number of variables. This is inferred from the cormat if not supplied. |
lambda |
Penalty to use for the score. If |
... |
Other arguments passed along to pcalg::GaussL0penObsScore. |
A Score object (S4), see pcalg::Score.
# Simulate data and compute correlation matrix
x1 <- rnorm(100)
x2 <- rnorm(100)
x3 <- x1 + x2 + rnorm(100)
d <- data.frame(x1, x2, x3)
cmat <- cor(d)
# Use gausCorScore with pcalg::ges()
pcalg::ges(gausCorScore(cmat, n = 100))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.