compileDecisionModel: Compile JAGS Models to Evaluate the Effect of Decisions in a...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/compileDecisionModel.R

Description

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.

Usage

1

Arguments

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 policyMatrix.

...

Additional arguments to pass to jags.model, excepting the data argument. The data argument is created by compileDecisionModel, and cannot be passed manually.

data

An optional list of data values to be observed in the nodes. It is passed to the data argument of rjags::jags. Any values given in data will override values provided in policyMatrix with a warning.

Details

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.

Value

Returns a list of compiledHydeNetwork objects.

Author(s)

Jarrod Dalton and Benjamin Nutter

See Also

policyMatrix compileJagsModel

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
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) 

HydeNet documentation built on July 8, 2020, 5:15 p.m.