idaFast | R Documentation |
This function estimates the multiset of possible total causal effects of
one variable (x
) on a several (i.e., a vector of) target
variables (y
) from observational data.
idaFast()
is more efficient than looping over
ida
. Only method="local"
(see ida
)
is available.
idaFast(x.pos, y.pos.set, mcov, graphEst)
x.pos |
(integer) position of variable |
y.pos.set |
integer vector of positions of the target variables
|
mcov |
covariance matrix that was used to estimate |
graphEst |
estimated CPDAG from the function
|
This function performs
ida(x.pos, y.pos, mcov, graphEst, method="local",
y.notparent=FALSE, verbose=FALSE)
for all values of y.pos
in
y.pos.set
simultaneously, in an efficient way.
See (the help about) ida
for more details. Note that the
option y.notparent = TRUE
is not implemented, since it is not
clear how to do that efficiently without orienting all edges away from
y.pos.set
at the same time, which seems not to be
desirable. Suggestions are welcome.
Matrix with length(y.pos.set)
rows. Row i
contains the multiset
of estimated possible total causal effects of x
on
y.pos.set[i]
. Note that all multisets in the matrix have the
same length, since the parents of x
are the same for all elements
of y.pos.set
.
Markus Kalisch (kalisch@stat.math.ethz.ch)
see the list in ida
.
pc
for estimating a CPDAG, and
ida
for estimating the multiset of possible total causal
effects from observational data on only one target variable but with many more
options (than here in idaFast
).
## Simulate the true DAG
set.seed(123)
p <- 7
myDAG <- randomDAG(p, prob = 0.2) ## true DAG
myCPDAG <- dag2cpdag(myDAG) ## true CPDAG
covTrue <- trueCov(myDAG) ## true covariance matrix
## simulate data from the true DAG
n <- 10000
dat <- rmvDAG(n, myDAG)
cov.d <- cov(dat)
## estimate CPDAG (see help on the function "pc")
suffStat <- list(C = cor(dat), n = n)
pc.fit <- pc(suffStat, indepTest = gaussCItest, alpha = 0.01, p=p)
if(require(Rgraphviz)) {
op <- par(mfrow=c(1,3))
plot(myDAG, main="true DAG")
plot(myCPDAG, main="true CPDAG")
plot(pc.fit@graph, main="pc()-estimated CPDAG")
par(op)
}
(eff.est1 <- ida(2,5, cov.d, pc.fit@graph))## method = "local" is default
(eff.est2 <- ida(2,6, cov.d, pc.fit@graph))
(eff.est3 <- ida(2,7, cov.d, pc.fit@graph))
## These three computations can be combinded in an efficient way
## by using idaFast :
(eff.estF <- idaFast(2, c(5,6,7), cov.d, pc.fit@graph))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.