Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/compileDecisionModel.R
Nodes at which a decision can be made, such as the decision to test or not test; treat or not treat; or use open or robotic surgery may impact the outcome for a subject. These types of decisions may not be truly random and understanding how these decisions may impact downstream outcomes may be beneficial to making the decision. Compiling the decision network permits the network to be evaluated under the conditions of each set of decisions separately.
1 | compileDecisionModel(network, policyMatrix = NULL, ..., data = NULL)
|
network |
A HydeNet object with decision nodes defined. |
policyMatrix |
A data frame of policies to apply to decision nodes
for comparing networks under different conditions. See
|
... |
Additional arguments to pass to |
data |
An optional list of data values to be observed in the nodes.
It is passed to the |
compileDecisionModel
only accepts nodes of type "dbern"
(Bernoulli random variable taking either 0 or 1) or "dcat"
(categorical variables) as decision nodes.
When the node is type "dcat"
, the
decision options are extracted from the JAGS statement returned by
writeJagsModel
.
The options for each decision node (if there are multiple nodes) are
combined via expand.grid
to make a table of all possible decisions.
Each row of this table is passed as a list to the data
argument
of jags.model
(via compileJagsModel
) and a list of JAGS
model objects is returned. coda.samples
may be run on each of these
models.
Returns a list of compiledHydeNetwork
objects.
Jarrod Dalton and Benjamin Nutter
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 | data(PE, package="HydeNet")
Net <- HydeNetwork(~ wells +
pe | wells +
d.dimer | pregnant*pe +
angio | pe +
treat | d.dimer*angio +
death | pe*treat,
data = PE)
Net <- setDecisionNodes(Net, treat)
plot(Net)
decision1 <- compileDecisionModel(Net)
#* An effectively equivalent call as the previous
decision2 <- compileDecisionModel(Net, policyMatrix(Net))
#* Using a customized policy matrix
#* Note: this is a bit of nonsense--you can't decide if a test is negative
#* or positive, but we'll do this for illustration.
custom_policy <- policyMatrix(Net,
treat="No",
angio = c("Negative", "Positive"))
decision3 <- compileDecisionModel(Net, custom_policy)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.