Description Usage Arguments Value See Also Examples
View source: R/sim_mixed_dag.non_parametric_dag_model.R
Simulate a dataset from a non parametric DAG model.
1 2 3 | ## S3 method for class 'non_parametric_dag_model'
sim_mixed_dag(dag_model, N = 1000,
...)
|
dag_model |
An object of class "non_parametric_dag_model". |
N |
Number of observations to simulate. |
... |
Additional arguments |
A dataset simulated from the input dag_model
.
sim_mixed_dag.parametric_dag_model
for parametric dag simulation.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.