GaussL0penObsScore-class | R Documentation |
"GaussL0penObsScore"
This class represents a score for causal inference from observational Gaussian
data; it is used in the causal inference function ges
.
The class implements an \ell_0
-penalized Gaussian maximum
likelihood estimator. The penalization is a constant (specified by
the argument lambda
in the constructor) times the number of
parameters of the DAG model. By default, the constant \lambda
is
chosen as \log(n)/2
, which corresponds to the BIC score.
Class "Score"
, directly.
All reference classes extend and inherit methods from "envRefClass"
.
The class GaussL0penObsScore
has the same fields as
Score
. They need not be accessed by the user.
new("GaussL0penObsScore", data = matrix(1, 1, 1), lambda = 0.5*log(nrow(data)), intercept = TRUE, use.cpp = TRUE, ...)
data
Data matrix with n
rows and p
columns. Each row
corresponds to one observational realization.
lambda
Penalization constant (cf. details)
intercept
Indicates whether an intercept is allowed in the linear structural equations, or, equivalently, if a mean different from zero is allowed for the observational distribution.
use.cpp
Indicates whether the calculation of the score should be done
by the C++ library of the package, which speeds up calculation. This
parameter should only be set to FALSE
in the case of problems.
local.score(vertex, parents, ...)
Calculates the local score of a vertex and its parents. Since this score has no obvious interpretation, it is rather for internal use.
global.score.int(edges, ...)
Calculates the global score of a DAG, represented as a list of in-edges: for each vertex in the DAG, this list contains a vector of parents.
global.score(dag, ...)
Calculates the global score of a DAG,
represented as an object of a class derived from
ParDAG
.
local.mle(vertex, parents, ...)
Calculates the local MLE of a vertex and its parents. The result is a vector of parameters encoded as follows:
First element: variance of the Gaussian error term
Second element: intercept
Following elements: regression coefficients; one per parent vertex
global.mle(dag, ...)
Calculates the global MLE of a DAG,
represented by an object of a class derived from
ParDAG
.
The result is a list of vectors, one per vertex, each in the same format
as the result vector of local.mle
.
Alain Hauser (alain.hauser@bfh.ch)
ges
,
GaussL0penIntScore
,
Score
##################################################
## Using Gaussian Data
##################################################
## Load predefined data
data(gmG)
## Define the score object
score <- new("GaussL0penObsScore", gmG$x)
## Score of the true underlying DAG
score$global.score(as(gmG$g, "GaussParDAG"))
## Score of the DAG that has only one edge from 1 to 2
A <- matrix(0, ncol(gmG$x), ncol(gmG$x))
A[1, 2] <- 1
score$global.score(as(A, "GaussParDAG"))
## (Note: this is lower than the score of the true DAG.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.