An R Companion to "Evidence Synthesis for Decision Making in Healthcare"
This is a collection of RMarkdown documents that run the original WinBUGs code from the book in JAGS from R.
Code that needed to be tweaked to run in JAGS:
- Chapter_04: There were 'Attempt to redefine node' errors in a couple of models. I moved the offending lines into data blocks, as recommended on stackoverflow.
- Chapter_09:
rankfunction; multi-dimensional data reformatted as list of matrixes. - Chapter_10: 'Attempt to redefine node' (use data blocks); Invalid parent values: Most of these issues are from 3d arrays in R being indexed differently than in JAGS. Divide by zero errors were worked around by adding a vanishingly small quantity to the denominator.
- Chapter_11: 'Attempt to redefine node' errors solved with data blocks.
- Chapter 12:
rankedfunction.
Note that the coda package has a 'bugs2jags' function that should obviate much of the 3d array munging I did in these scripts.