178 Bayesian Methods in Health Economics
mean and standard deviation and then compute the precision (required by
JAGS/BUGS) as the reciprocal of the variance.
Finally, we use the function lognPar (cfr. §4.7) to compute the parameters
of the distribution of the length of time with influenza, which is modelled on
the log scale.
The model can now be run calling the function JAGS, which we do using
the following code.
library(R2jags)
dataJags <- list("S","H","r0","r1","n0","n1","x","m",
"mu.inf","tau.inf","mu.l","tau.l")
filein <- "EvSynth.txt"
params <- c("p0","p1","rho","l","c.inf","alpha","delta","gamma")
inits <- function(){
list(alpha=rnorm(S,0,1),delta=rnorm(S,0,1),mu.delta=rnorm(1),
sigma.delta=runif(1),gamma=rnorm(H,0,1),mu.gamma=rnorm(1),
sigma.gamma=runif ...