sim_mixed_dag.non_parametric_dag_model: Simulate a dataset from a non parametric DAG model

Description Usage Arguments Value See Also Examples

View source: R/sim_mixed_dag.non_parametric_dag_model.R

Description

Simulate a dataset from a non parametric DAG model.

Usage

1
2
3
## S3 method for class 'non_parametric_dag_model'
sim_mixed_dag(dag_model, N = 1000,
  ...)

Arguments

dag_model

An object of class "non_parametric_dag_model".

N

Number of observations to simulate.

...

Additional arguments

Value

A dataset simulated from the input dag_model.

See Also

sim_mixed_dag.parametric_dag_model for parametric dag simulation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
require(carData); require(dagitty)
data("GSSvocab")
GSSvocab <- GSSvocab[complete.cases(GSSvocab), ]
g <- dagitty("dag {
             ageGroup [pos=\"0,0\"]
             vocab [pos=\"1,-1\"]
             nativeBorn [pos=\"2,-2\"]
             educ [pos=\"3,-1\"]
             gender [pos=\"4,0\"]
             nativeBorn -> educ
             nativeBorn -> vocab
             educ -> vocab
             gender -> educ
             ageGroup -> vocab
             }")
plot(g)
non_param_dag_model <- non_parametric_dag_model(dag = g, data = GSSvocab)
sim_data <- sim_mixed_dag(dag_model = non_param_dag_model, N = 30000)
boxplot(vocab ~ nativeBorn, data = sim_data)
# verify distribtion in simulated dataset looks similar
boxplot(vocab ~ nativeBorn, data = GSSvocab)

IyarLin/simMixedDAG documentation built on Oct. 30, 2019, 7:28 p.m.