Here is how you can wrap a log-posterior function for the
SIR
model fitted to the epi3
data set, with
fixed initial conditions of 999 susceptibles, 1 infected, and 0
recovered.
my_dLogPosteriorEpi3 <- function(theta) {
return(my_dLogPosterior(
fitmodel = sirDeter,
theta = theta,
initState = c(S = 999, I = 1, R = 0),
data = epi3
))
}
You can copy and paste the function into your R session, and proceed from there.
Return to the MCMC diagnostics session.
This web site and the material contained in it were originally created in support of an annual short course on Model Fitting and Inference for Infectious Disease Dynamics at the London School of Hygiene & Tropical Medicine. All material is under a MIT license. Please report any issues or suggestions for improvement on the corresponding GitHub issue tracker. We are always keen to hear about any uses of the material here, so please do get in touch using the Discussion board if you have any questions or ideas, or if you find the material here useful or use it in your own teaching.