Learn R Programming

causalDisco (version 0.9.5)

gausCorScore: Gaussian L0 score computed on correlation matrix

Description

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.

Usage

gausCorScore(cormat, n, p = NULL, lambda = NULL, ...)

Value

A Score object (S4), see pcalg::Score.

Arguments

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 NULL (default), the BIC score penalty is used. See pcalg::GaussL0penObsScore for further details.

...

Other arguments passed along to pcalg::GaussL0penObsScore.

Examples

Run this code
# 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))


Run the code above in your browser using DataLab