Description Usage Arguments Value See Also Examples
View source: R/get_ate.non_parametric_dag_model.R
get_ate.non_parametric_dag_model
uses simulations
to calculate the average treatment effect (ATE) of
a treatment variable on an exposure variable given
a non parametric DAG model.
1 2 3 |
dag_model |
An object of class "non_parametric_dag_model". |
treatment |
Name of a single treatment variable. |
treatment_vals |
A vector of treatment values to be considered. |
exposure |
Name of a single exposure variable. |
M |
Number of simulations to run. Each simulation dataset consists of 1000 observations. |
A data.frame with 3 columns:
From: The baseline treatment value.
To: The value a treatment was changed to.
ATE: The average treatment effect of changing the treatment value from "From" to "To.
get_ate.parametric_dag_model
for parametric DAG model ATE calculation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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)
nativeBorn_ATE_on_vocab <- get_ate(dag_model=non_param_dag_model,
treatment="nativeBorn",
exposure="vocab")
print(nativeBorn_ATE_on_vocab)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.