GaussParDAG-class {pcalg} | R Documentation |
Class "GaussParDAG"
of Gaussian Causal Models
Description
The "GaussParDAG"
class represents a Gaussian causal model.
Details
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).
Extends
Class "ParDAG"
, directly.
All reference classes extend and inherit methods from
"envRefClass"
.
Constructor
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.
Fields
.nodes
:Vector of node names; defaults to
as.character(1:p)
, wherep
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. Thei
-th entry lists the indices of the parents of thei
-th node..params
:A list of length
p
consisting of parameter vectors modeling the conditional distribution of a node given its parents. Thei
-th entry models the conditional (normal) distribution of thei
-th variable in the model given its parents. It is a vector of lengthk + 2
, wherek
is the number of parents of nodei
; the first entry encodes the error variance of nodei
, 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 functionserr.var
,intercept
andweight.mat
.
Class-Based Methods
set.err.var(value)
:Sets the error variances. The argument must be a vector of length
p
, wherep
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
, wherep
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 whosei
-th columns contains the regression coefficients of thei
-th structural equation, if nodei
is not intervened (i.e., ifi
is not contained in the vectortarget
), 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; otherwisetarget
is a vector of the intervened nodes, andivent.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")
Author(s)
Alain Hauser (alain.hauser@bfh.ch)
References
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
See Also
Examples
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)