get_ate.parametric_dag_model: Get ATE for a paramteric DAG model

Description Usage Arguments Value See Also Examples

View source: R/get_ate.parametric_dag_model.R

Description

get_ate.parametric_dag_model uses simulations to calculate the average treatment effect (ATE) of a treatment variable on an exposure variable given a parametric DAG model.

Usage

1
2
3
## S3 method for class 'parametric_dag_model'
get_ate(dag_model, treatment,
  treatment_vals = NULL, exposure, M = 1000)

Arguments

dag_model

An object of class "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.

Value

A data.frame with 3 columns:

  1. From: The baseline treatment value.

  2. To: The value a treatment was changed to.

  3. ATE: The average treatment effect of changing the treatment value from "From" to "To.

See Also

get_ate.non_parametric_dag_model for non parametric dag model ATE calculation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require(dagitty)
g <- dagitty("dag {
sales [pos=\"0,0\"]
             mkt [pos=\"2,0\"]
             comp [pos=\"1,1\"]
             visits [pos=\"1,0\"]
             visits -> sales
             mkt -> visits
             comp -> mkt
             comp -> sales
             }")
plot(g)
param_dag_model <- parametric_dag_model(
  dag = g,
  f.args = list(
    sales = list(betas = list(visits = 0.3, comp = -0.9)),
    visits = list(betas = list(mkt = 0.5)),
    mkt = list(betas = list(comp = 0.6))
  )
)
sim_data <- sim_mixed_dag(dag_model = param_dag_model)
plot(sim_data$mkt, sim_data$sales) # confounded relation
mkt_ATE_on_sales <- get_ate(dag_model = param_dag_model, treatment = "mkt", 
                            treatment_vals = -2:2, exposure = "sales")
print(mkt_ATE_on_sales) # true relation

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