parametric_dag_model: Specify a parametric DAG model

Description Usage Arguments Details Value See Also Examples

View source: R/parametric_dag_model.R

Description

parametric_dag_model is used to specify paramteric DAG models. Any none specified function arguments are filled in using defaults. The resulting obejct of class "parametric_dag_model" has methods to simulate observations from the model specified and get it's ATEs.

Usage

1
parametric_dag_model(dag, f.args = NULL)

Arguments

dag

An object of class "dagitty" representing the DAG.

f.args

A list specifying the different node function arguments.

Details

Every node j in a parametric DAG model is simulated from a function of the node parents PA_{j} and additional arguments. Denoting by lp = ∑_{i in PA_{j}} β_{ij}x_i the linear combination of the parent nodes, the function for a continuous node looks like the following:

f(PA_{node}) = g(lp + ε)

and the following for a discrete node:

f(PA_{node}) = cat(g(lp + ε))

f.args is a list where each element is in itself a list specifying the additional function arguments relating to the node after which that element is named after (this is a long sentence, see examples below).

The f.args elements can include the following optional elements:

  1. levels: The number of levels a discrete node takes. levels = 1 means the node is continuous.

  2. betas: A list. Each element is a vector/scalar denoting the β coefficients of the parent node after which it is named.

  3. link: The link function g. One of "identity", "quadratic", "exp" or "cosin".

  4. sinr: Signal to ratio. This ensures that var(lp) / var(ε) = sinr

Value

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

  1. dag: The model DAG

  2. f.args: The f.args input, with all non specified arguments set using defaults.

See Also

non_parametric_dag_model for non parametric DAG model specification. Methods for the parametric_dag_model class include sim_mixed_dag.parametric_dag_model for simulating datasets and get_ate.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
22
23
24
25
26
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

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