dag_system: Specify and simulate data from structural equation model

View source: R/simulation.R

dag_systemR Documentation

Specify and simulate data from structural equation model

Description

Create and run structural equation model using formulas for each node.

Usage

dag_system(..., seed = NULL)

Arguments

...

Formulas specifying the model.

seed

an optional random seed for use in set.seed().

starter

an optional data frame defining exogenous values of the variables in the formulas.

Details

There cannot be any cycles in the DAG (as the name DAG indicates.) You can use uniform(), gaussian(), discrete(), or toss_up as random inputs. They correspond respectively to runif, rnorm, sample, and Bernouilli trials.

Examples

dag <- dag_system(A ~ uniform(), B ~ 3 + 10*A)
dag_simulate(dag, n = 5)

dtkaplan/SDSdata documentation built on June 28, 2022, 8:09 a.m.