Skip to main content

Validate a backdoor adjustment set

Source: R/identification.R

Description

Tests whether given is a valid backdoor set for the effect of x on y. It is if (1) no node in given is a descendant of x, and (2) given blocks every backdoor path from x to y (every parent of x is d-separated from y given given together with x).

Usage

is_valid_backdoor(cg, x, y, given = character())

Arguments

cg A DAG or ADMG created with cgraph().
x, y Exposure and outcome node name, or character vector of node names.
given Character vector of adjustment node names (may be empty).

Value

TRUE if given satisfies the backdoor criterion.

Examples

dag <- cgraph(A %-->% X, X %-->% Y, A %-->% Y)
is_valid_backdoor(dag, "X", "Y") # A --> Y left open
#> [1] FALSE
is_valid_backdoor(dag, "X", "Y", "A")
#> [1] TRUE