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 `igraph` object describing a causal model with a single selection variable in the internal syntax. `expr` A logical value. If `TRUE`, a string is returned describing the expression in LaTeX syntax. Else, a list structure is returned which can be manually parsed by the function `get.expression` `simp` A logical value. If `TRUE`, a simplification procedure is applied to the resulting probability object. d-separation and the rules of do-calculus are applied repeatedly to simplify the expression. `steps` A logical value. If `TRUE`, returns a list where the first element corresponds to the expression of the causal effect and the second to the a list describing intermediary steps taken by the algorithm. `primes` A logical value. If `TRUE`, prime symbols are appended to summation variables to make them distinct from their other instantiations. `stop_on_nonid` A logical value. If `TRUE`, an error is produced when a non-identifiable effect is discovered. Otherwise recursion continues normally.

### 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.

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.

`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)
```

[Package causaleffect version 1.3.13 Index]