make_model | R Documentation |
make_model
uses dagitty syntax and functionality to specify nodes and edges of a
graph. Implied causal types are calculated and default priors are provided under the
assumption of no confounding.
Models can be updated with specification of a parameter matrix, P
, by
providing restrictions on causal types, and/or by providing informative priors on parameters.
The default setting for a causal model have flat (uniform) priors and parameters
putting equal weight on each parameter within each parameter set. These can be
adjust with set_priors
and set_parameters
make_model(statement, add_causal_types = TRUE)
statement |
A character. Statement describing causal relations using dagitty syntax. Only directed relations are permitted. For instance "X -> Y" or "X1 -> Y <- X2; X1 -> X2". |
add_causal_types |
Logical. Whether to create and attach causal types to |
An object of class causal_model
.
An object of class "causal_model"
is a list containing at least the
following components:
dag |
A |
node |
A named |
statement |
A character vector of the statement that defines the model |
nodal_types |
A named |
parameters_df |
A |
make_model(statement = "X -> Y") modelXKY <- make_model("X -> K -> Y; X -> Y") # Example where cyclicaly dag attempted ## Not run: modelXKX <- make_model("X -> K -> X") ## End(Not run) # Examples with confounding model <- make_model("X->Y; X <-> Y") model$P model <- make_model("Y2 <- X -> Y1; X <-> Y1; X <-> Y2") dim(model$P) model$P model <- make_model("X1 -> Y <- X2; X1 <-> Y; X2 <-> Y") dim(model$P) model$parameters_df # A single node graph is also possible model <- make_model("X") # Unconnected nodes cannot ## Not run: model <- make_model("X <-> Y") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.