Description Usage Arguments Details Value Author(s) Examples
It may be of interest to compare posterior distributions of
variables dependent on differing levels of the decision nodes. For
example, how might choosing a different engine in a car affect the
fuel consumption. policyMatrix
provides a quick utility to
begin defining the policy matrix on which decisions can be made.
1 2 3 | policyMatrix(network, ..., useDefaultPolicies = TRUE)
defaultPolicyMatrix(network)
|
network |
A HydeNetwork object |
... |
Named arguments with vectors of the policy values. |
useDefaultPolicies |
A logical indicating if the default policy
values from decision nodes should be used for any decision nodes
not named in |
When ...
is not used, the default policy matrix is defined
as all possible combinations of the levels in the network's decision
nodes. If no decision nodes are defined, an error is returned. Note that
the default policy matrix returns JAGS-ready values, which are numeric
according to the level number of a factor. In user-defined matrices,
character values are supported and will be converted to numerics when the
JAGS model is compiled.
Semi-custom policy matrices can be defined by providing the values of each node to be considered. When manually supplying values, the nodes must exist in network, but the requirement that they be decision nodes is not enforced. Thus, it is possible to include numeric values in a decision matrix.
Policy matrices can be passed to HydeSim
to run posterior
distributions on each row of the policy matrix. There is nothing
particularly special about the policy matrices returned by
policyMatrix
; they are simply data frame that require names drawn
from the nodes in the network. Any data frame can be passed to
HydeSim
and a check is done there to confirm all of the
column names match a node in the network.
Whenever a node is identified as a deterministic node, its policy values
are forced to NULL
, regardless of what the user has specified.
Returns a data frame built by expand.grid
and intended to be
used with HydeSim
.
Jarrod Dalton and Benjamin Nutter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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, angio, treat)
plot(Net)
policyMatrix(Net)
policyMatrix(Net, treat="No", angio = c("No", "Yes"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.