Learn R Programming

simcausal (version 0.5.7)

A: Subsetting/Indexing Actions Defined for DAG Object

Description

Subsetting/Indexing Actions Defined for DAG Object

Usage

A(DAG)

Value

returns a list of actions, which are intervened versions of the original observed data DAG.

Arguments

DAG

A DAG object that was defined using functions node, set.DAG and action.

Examples

Run this code

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.5*W1+ 0.5*W2))
D <- set.DAG(D)
# Define two actions, acting on node "A"
D <- D + action("A0", nodes=node("A", distr="rbern", prob=0))
D <- D + action("A1", nodes=node("A", distr="rbern", prob=1))
# Select both actions
A(D)
# Select action "A1" only
A(D)["A1"]

Run the code above in your browser using DataLab