Skip to main content

Find an instrument and its conditioning set

Source: R/identification.R

Description

Finds an instrument z for the causal effect of x on y, together with a conditioning set given that makes it valid (see is_valid_iv()). For each candidate instrument, given is a separator of y and the instrument in the graph with the first edge of every causal path from x to y removed, chosen nearest to y. The pair with the smallest given is returned, so an unconditional instrument is preferred.

Usage

iv_set(cg, x, y, restrict = NULL)

Arguments

cg A DAG or ADMG created with cgraph().
x Exposure node name.
y Outcome node name, or character vector of node names.
restrict Character vector of the nodes allowed in z and given, e.g. the observed ones. NULL (default) allows every node.

Value

A list with character vectors z and given, or NULL if no instrument exists.

References

van der Zander B, Textor J, Liśkiewicz M (2015). “Efficiently Finding Conditional Instruments for Causal Inference.” In Proceedings of the 24th International Joint Conference on Artificial Intelligence (IJCAI 2015), 3243–3249.

Examples

dag <- cgraph(W %-->% Z + Y, Z %-->% X %-->% Y, U %-->% X + Y)
iv_set(dag, "X", "Y")
#> $z
#> [1] "Z"
#> 
#> $given
#> [1] "W"

# Without W observed, there is no instrument
is.null(iv_set(dag, "X", "Y", restrict = c("Z", "X", "Y")))
#> [1] TRUE