Description Usage Arguments Details Value See Also Examples
View source: R/parametric_dag_model.R
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.
1 | parametric_dag_model(dag, f.args = NULL)
|
dag |
An object of class "dagitty" representing the DAG. |
f.args |
A list specifying the different node function arguments. |
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:
levels
: The number of levels a discrete node takes. levels
= 1 means
the node is continuous.
betas
: A list. Each element is a vector/scalar denoting the β coefficients
of the parent node after which it is named.
link
: The link function g
. One of "identity", "quadratic", "exp" or "cosin".
sinr
: Signal to ratio. This ensures that var(lp) / var(ε) = sinr
An object of class "parametric_dag_model" which is essentially a list containing the following elements:
dag: The model DAG
f.args: The f.args input, with all non specified arguments set using defaults.
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.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.