sem_sim | R Documentation |
Generates samples from a structural causal model (SCM). In scm_sim
, the DAG is implemented
by formulas, with the response variable on the left and the value to be calculated.
on the right.
sem_sim(story = NULL, ..., samp_n = 5)
story |
Optional list containing formulas and/or label names |
... |
more formulas describing the process and/or label names |
samp_n |
Integer giving the number of rows in the output |
You can set the exogenous random component of any variable by using
the desired r____()
random number generator with samp_n
as the value of size.
A label name can be an element of ...
or story
. This label will be used to denote
the observed value if the underlying variable is 1. (o
or 0 is used otherwise.)
sem_sim(X ~ rnorm(samp_n), Y ~ 10 + runif(samp_n) + 5 * X, samp_n = 20) sem_sim(X ~ 0, Y ~ 10* X - 1, Z ~ - 3 + 10 * Y, X = 1, Y = "murder", Z = "telegraph", samp_n = 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.