recover {causaleffect} | R Documentation |
Recover a causal effect from selection bias
Description
This function attempts to recover the causal effect of the set of variables (y
)
given the intervention on the set of variables (x
) in graph (G
) containing a single selection variable. Otherwise
an error is thrown describing the graphical structure that witnesses non-identifiability. The vertex of (G
) that corresponds to the selection variable must have a description parameter of a single character "S" (shorthand for "selection"). 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
recover(y, x, G, expr = TRUE, simp = TRUE,
steps = FALSE, primes = 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. |
G |
An |
expr |
A logical value. If |
simp |
A logical value. If |
steps |
A logical value. If |
primes |
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
Bareinboim E., Tian J. 2015 Recovering Causal Effects From Selection Bias. In Proceedings of the 29th AAAI Conference on Artificial Intelligence, 3475–3481.
See Also
parse.graphml
, get.expression
, generalize
, meta.transport
Examples
library(igraph)
# We set simplify = FALSE to allow multiple edges.
g <- graph.formula(W_1 -+ X, W_2 -+ X, X -+ Y, # Observed edges
W_2 -+ S, # The selection variable S
W_1 -+ W_2, W_2 -+ W_1, W_1 -+ Y, Y -+ W_1, simplify = FALSE)
# Here the bidirected edges are set to be unobserved in the selection diagram d.
# This is denoted by giving them a description attribute with the value "U".
# The first five edges are observed, the rest are unobserved.
g <- set.edge.attribute(g, "description", 5:8, "U")
# The variable "S" is a selection variable. This is denoted by giving it
# a description attribute with the value "S".
g <- set.vertex.attribute(g, "description", 5, "S")
recover(y = "Y", x = "X", G = g)