parents: Show Node Parents Given DAG Object

Description Usage Arguments Value Examples

View source: R/simcausal.r

Description

Given a vector of node names, this function provides the name(s) of node parents that were obtained by parsing the node formulas.

Usage

1
parents(DAG, nodesChr)

Arguments

DAG

A DAG object that was specified by calling set.DAG

nodesChr

A vector of node names that are already defined in DAG

Value

A list with parent names for each node name in nodesChr

Examples

1
2
3
4
5
6
7
D <- DAG.empty()
D <- D + node(name="W1", distr="rbern", prob=plogis(-0.5))
D <- D + node(name="W2", distr="rbern", prob=plogis(-0.5 + 0.5*W1))
D <- D + node(name="A", distr="rbern", prob=plogis(-0.5 - 0.3*W1 - 0.3*W2))
D <- D + node(name="Y", distr="rbern", prob=plogis(-0.1 + 1.2*A + 0.3*W1 + 0.3*W2), EFU=TRUE)
D <- set.DAG(D)
parents(D, c("W2", "A", "Y"))

osofr/simcausal documentation built on Jan. 6, 2019, 3:05 a.m.