Learn R Programming

CausalQueries (version 0.0.3)

reveal_outcomes: Reveal outcomes

Description

Reveal outcomes for all causal types. Calculated by sequentially calculating endogenous nodes. If a do operator is applied to any node then it takes the given value and all its descendants are generated accordingly.

Usage

reveal_outcomes(model, dos = NULL, node = NULL)

Arguments

model

A causal_model. A model object generated by make_model.

dos

A named list. Do actions defining node values, e.g., list(X = 0, M = 1).

node

A character. An optional quoted name of the node whose outcome should be revealed. If specified all values of parents need to be specified via dos.

Value

A data.frame object of revealed data for each node (columns) given causal / nodal type (rows) .

Details

reveal_outcomes starts off by creating types (via get_nodal_types). It then takes types of endogenous and reveals their outcome based on the value that their parents took. Exogenous nodes outcomes correspond to their type.

Examples

Run this code
# NOT RUN {
model <- make_model("X -> Y")
reveal_outcomes(model)

model <- make_model("X1->Y;X2->M;M->Y")
reveal_outcomes(model, dos = list(X1 = 1, M = 0))

model <- make_model("X->M->Y")
reveal_outcomes(model, dos = list(M = 1), node = "Y")
# }

Run the code above in your browser using DataLab