Skip to main content

Enumerate all valid instrumental variable sets

Source: R/identification.R

Description

Finds all minimal (or all) sets of valid instruments for identifying the causal effect of x on y, conditionally on given; see is_valid_iv(). To also search for the conditioning set, use iv_set().

Usage

all_iv_sets(
  cg,
  x,
  y,
  given = character(),
  minimal = TRUE,
  max_size = 3,
  include = character(),
  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.
given Character vector of node names the instruments are conditionally valid given (may be empty).
minimal If TRUE (default), return only minimal sets.
max_size Maximum number of instruments to consider.
include Character vector of nodes forced into every set.
restrict Character vector of candidate instruments. NULL (default) allows every node except x and y.

Value

List of character vectors (empty list if none exist).

Examples

dag <- cgraph(
  Z1 %-->% X, Z2 %-->% X, X %-->% Y, U %-->% X, U %-->% Y
)
all_iv_sets(dag, "X", "Y")
#> [[1]]
#> [1] "Z1"
#> 
#> [[2]]
#> [1] "Z2"