#Load the campylobacteriosis data for Germany
data("campyDE")
#Make an sts object from the data.frame
cam.sts <- new("sts",epoch=as.numeric(campyDE$date),observed=campyDE$case,
state=campyDE$state, epochAsDate=TRUE)
#Trial run code. To be made an actual working example.
#source("../R/boda.R")
# define monitoring period
# range <- which(epoch(cam.sts)>=as.Date("2007-01-01"))
# range <- which(epoch(cam.sts)>=as.Date("2011-12-10"))
range <- tail(1:nrow(cam.sts),n=2)
control <- list(range=range, X=NULL, trend=TRUE, season=TRUE,
prior='iid', alpha=0.025, mc.munu=100, mc.y=10)
#Apply the boda algorithm in its simples form, i.e. spline is
#described by iid random effects and no extra covariates
#(NOTE: requires the INLA package to be installed)
cam.boda1 <- boda(cam.sts, control=control)
#In case INLA is not installed, boda throws an error
if(!inherits(cam.boda1,'try-error')){
plot(cam.boda1,xlab='time [weeks]', ylab='No. reported',dx.upperbound=0)
}
Run the code above in your browser using DataLab