Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ancestorGraph

Ancestor Graph


Description

Creates the induced subgraph containing only the vertices in v, their ancestors, and the edges between them. All other vertices and edges are discarded.

Usage

ancestorGraph(x, v = NULL)

Arguments

x

the input graph, a DAG, MAG, or PDAG.

v

variable names.

Details

If the input graph is a MAG or PDAG, then all *possible* ancestors will be returned (see Examples).

Examples

g <- dagitty("dag{ z <- x -> y }")
ancestorGraph( g, "z" )

g <- dagitty("pdag{ z -- x -> y }")
ancestorGraph( g, "y" ) # includes z

dagitty

Graphical Analysis of Structural Causal Models

v0.3-1
GPL-2
Authors
Johannes Textor, Benito van der Zander, Ankur Ankan
Initial release
2021-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.