causal.effect {causaleffect} | R Documentation |
Identify a causal effect
Description
This function returns an expression for the joint distribution of the set of variables (y
)
given the intervention on the set of variables (x
) conditional on (z
) if the effect is identifiable. Otherwise
an error is thrown describing the graphical structure that witnesses non-identifiability. If steps = TRUE
, returns instead
a list where the first element is the expression and the second element is a list of the intermediary steps taken by the algorithm.
Usage
causal.effect(y, x, z = NULL, G, expr = TRUE, simp = FALSE,
steps = FALSE, primes = FALSE, prune = FALSE, stop_on_nonid = TRUE)
Arguments
y |
A character vector of variables of interest given the intervention. |
x |
A character vector of the variables that are acted upon. |
z |
A character vector of the conditioning variables. |
G |
An |
expr |
A logical value. If |
simp |
A logical value. If |
steps |
A logical value. If |
primes |
A logical value. If |
prune |
A logical value. If |
stop_on_nonid |
A logical value. If |
Value
If steps = FALSE
, A character string or an object of class probability
that describes the interventional distribution. Otherwise, a list as described in the arguments.
Author(s)
Santtu Tikka
References
Shpitser I., Pearl J. 2006 Identification of Joint Interventional Distributions in Recursive semi-Markovian Causal Models. Proceedings of the 21st National Conference on Artificial Intelligence, 2, 1219–1226.
Shpitser I., Pearl J. 2006 Identification of Conditional Interventional Distributions. Proceedings of the 22nd Conference on Uncertainty in Artificial Intelligence, 427–444.
See Also
Examples
library(igraph)
# simplify = FALSE to allow multiple edges
g <- graph.formula(x -+ y, z -+ x, z -+ y , x -+ z, z -+ x, simplify = FALSE)
# Here the bidirected edge between X and Z is set to be unobserved in graph g
# This is denoted by giving them a description attribute with the value "U"
# The edges in question are the fourth and the fifth edge
g <- set.edge.attribute(graph = g, name = "description", index = c(4,5), value = "U")
causal.effect("y", "x", G = g)
# Pruning example
p <- graph.formula(x -+ z_4, z_4 -+ y, z_1 -+ x, z_2 -+ z_1,
z_3 -+ z_2, z_3 -+ x, z_5 -+ z_1, z_5 -+ z_4, x -+ z_2, z_2 -+ x,
z_3 -+ z_2, z_2 -+ z_3, z_2 -+ y, y -+ z_2,
z_4 -+ y, y -+ z_4, z_5 -+ z_4, z_4 -+ z_5, simplify = FALSE)
p <- set.edge.attribute(p, "description", 9:18, "U")
causal.effect("y", "x", G = p, primes = TRUE, prune = TRUE)
# Simplification example
s <- graph.formula(x -+ y, w -+ x, w -+ z, z -+ y)
causal.effect("y", "x", G = s, simp = FALSE)
causal.effect("y", "x", G = s, simp = TRUE)