GaussParDAG-class | R Documentation |
"GaussParDAG"
of Gaussian Causal ModelsThe "GaussParDAG"
class represents a Gaussian causal model.
The class "GaussParDAG"
is used to simulate observational
and/or interventional data from Gaussian causal models as well as for parameter
estimation (maximum-likelihood estimation) for a given DAG structure in the
presence of a data set with jointly observational and interventional data.
A Gaussian causal model can be represented as a set of p
linear
structural equations with Gaussian noise variables. Those equations are
fully specified by indicating the regression parameters, the intercept
and the variance of the noise or error terms. More details can be found e.g.
in Kalisch and Bühlmann (2007) or Hauser and Bühlmann (2012).
Class "ParDAG"
, directly.
All reference classes extend and inherit methods from
"envRefClass"
.
new("GaussParDAG", nodes, in.edges, params)
nodes
Vector of node names; cf. also field .nodes
.
in.edges
A list of length p
consisting of index
vectors indicating the edges pointing into the nodes of the DAG.
params
A list of length p
consisting of parameter
vectors modeling the conditional distribution of a node given its
parents; cf. also field .params
for the meaning of the
parameters.
.nodes
:Vector of node names; defaults to as.character(1:p)
,
where p
denotes the number of nodes (variables) of the model.
.in.edges
:A list of length p
consisting of index
vectors indicating the edges pointing into the nodes of the DAG. The
i
-th entry lists the indices of the parents of the i
-th node.
.params
:A list of length p
consisting of parameter
vectors modeling the conditional distribution of a node given its
parents. The i
-th entry models the conditional (normal)
distribution of the i
-th variable in the model given its parents.
It is a vector of length k + 2
, where k
is the number of
parents of node i
; the first entry encodes the error variance of
node i
, the second entry the intercept, and the remaining entries
the regression coefficients (see above). In most cases, it is easier
to access the parameters via the wrapper functions err.var
,
intercept
and weight.mat
.
set.err.var(value)
:Sets the error variances. The argument
must be a vector of length p
, where p
denotes the number
of nodes in the model.
err.var()
:Yields the vector of error variances.
intercept()
:Yields the vector of intercepts.
set.intercept(value)
:Sets the intercepts. The argument
must be a vector of length p
, where p
denotes the number
of nodes in the model.
weight.mat(target)
:Yields the (observational or
interventional) weight matrix of the model. The weight matrix is an
p \times p
matrix whose i
-th columns contains the
regression coefficients of the i
-th structural equation, if node
i
is not intervened (i.e., if i
is not contained in the
vector target
), and is empty otherwise.
cov.mat(target, ivent.var)
:Yields the covariance matrix
of the observational or an interventional distribution of the causal
model. If target
has length 0, the covariance matrix of the
observational distribution is returned; otherwise target
is a
vector of the intervened nodes, and ivent.var
is a vector of the
same length indicating the variances of the intervention levels.
Deterministic interventions with fix intervention levels would correspond
to vanishing intervention variances; with non-zero intervention variances,
stochastic interventions are considered in which intervention values are
realizations of Gaussian variables (Korb et al., 2004).
The following methods are inherited (from the corresponding class):
node.count
("ParDAG"), edge.count
("ParDAG"), simulate
("ParDAG")
Alain Hauser (alain.hauser@bfh.ch)
A. Hauser and P. Bühlmann (2012). Characterization and greedy learning of interventional Markov equivalence classes of directed acyclic graphs. Journal of Machine Learning Research 13, 2409–2464.
M. Kalisch and P. Buehlmann (2007). Estimating high-dimensional directed acyclic graphs with the PC-algorithm. Journal of Machine Learning Research 8, 613–636.
K.B. Korb, L.R. Hope, A.E. Nicholson, and K. Axnick (2004). Varieties of causal intervention. Proc. of the Pacific Rim International Conference on Artificial Intelligence (PRICAI 2004), 322–331
ParDAG
set.seed(307)
myDAG <- r.gauss.pardag(p = 5, prob = 0.4)
(wm <- myDAG$weight.mat())
m <- as(myDAG, "matrix") # TRUE/FALSE adjacency matrix
symnum(m)
stopifnot(identical(unname( m ),
unname(wm != 0)))
myDAG$err.var()
myDAG$intercept()
myDAG$set.intercept(runif(5, min=3, max=4))
myDAG$intercept()
if (require(Rgraphviz)) plot(myDAG)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.