non_parametric_dag_model: Specify a non parametric DAG model

Description Usage Arguments Details Value See Also Examples

View source: R/non_parametric_dag_model.R

Description

non_parametric_dag_model is used to specify non paramteric DAG models. The non parametric node functions are obtained by fitting generalized additive models to a supplied (usually "real life") dataset. The resulting obejct of class "non_parametric_dag_model" has methods to simulate observations from the model specified and get ATEs.

Usage

1

Arguments

dag

An object of class "dagitty" representing the DAG.

data

A data.frame to be used for fitting the GAMs (no missing values allowed).

Details

Every node j in a non parametric DAG model is simulated from a non paramteric function of the node parents PA_{j}:

f_j(PA_j) = g(∑_{i \in PA_j}s_{ij}(x_i) + ε_j)

The smooth functions s_{ij}(.) are obtained by fitting generalized additive model to the node (as a reponse) and it's parents (as predictors).

Value

An object of class "non_parametric_dag_model" which is essentially a list containing the following elements:

  1. dag: The model DAG

  2. gam_fits: All smoothing functions and other information required for simulating new datasets from the specified dag model

See Also

parametric_dag_model for parametric DAG model specification. Methods for the non_parametric_dag_model class include sim_mixed_dag.non_parametric_dag_model for simulating datasets and get_ate.non_parametric_dag_model for getting ATEs.

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.