bindSim: Bind Output From coda Samples

Description Usage Arguments Details Author(s) Examples

View source: R/bindPosterior.R

Description

After determining the simulated distributions are satisfactory, it can be advantageous to bind the simulated distributions together in order to aggregate values and perform other manipulations and analyses.

Usage

1
2
3
bindSim(hydeSim, relabel_factor = TRUE)

bindPosterior(hydeSim, relabel_factor = TRUE)

Arguments

hydeSim

An object of class HydeSim

relabel_factor

Logical. If TRUE, factors that had been converted to integers for the JAGS code can be relabelled as factors for additional analysis in R.

Details

For the purposes of this function, it is assumed that if the simulated distributions are satisfactory, the multiple chains in a run can be bound together. Subsequently, the multiple runs are bound together. Lastly, the factors are relabeled, if requested.

Author(s)

Jarrod Dalton and Benjamin Nutter

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
27
#' data(PE, package="HydeNet")
Net <- HydeNetwork(~ wells + 
                     pe | wells + 
                     d.dimer | pregnant*pe + 
                     angio | pe + 
                     treat | d.dimer*angio + 
                     death | pe*treat,
                     data = PE) 
  
                 
compiledNet <- compileJagsModel(Net, n.chains=5)

#* Generate the simulated distribution
Simulated <- HydeSim(compiledNet, 
                     variable.names = c("d.dimer", "death"), 
                     n.iter=1000)

Bound <- bindSim(Simulated)

#* Bind a Decision Network
#* Note: angio shouldn't really be a decision node.  
#*       We use it here for illustration
Net <- setDecisionNodes(Net, angio, treat)
compiledDecision <- compileDecisionModel(Net, n.chains=5)
SimulatedDecision <- HydeSim(compiledDecision, 
                             variable.names = c("d.dimer", "death"),
                             n.iter = 1000)

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