boda: Surveillance for an univariate count data time series using...

Description Usage Arguments Details Author(s) References Examples

Description

The function takes range values of the surveillance time series sts and for each time point uses a negative binomial regression model to compute the predictive posterior distribution for the current observation. The (1-alpha)*100 quantile of this predictive distribution is then used as bound: If the actual observation is above the bound an alarm is raised.

Usage

1
2
3
4
boda(sts, control=list(range=NULL, X=NULL, trend=FALSE,
     season=FALSE, prior=c('iid','rw1','rw2'), alpha=0.05,
     mc.munu=100, mc.y=10, verbose=FALSE,multicore=TRUE,
     samplingMethod=c('joint','marginals')))

Arguments

sts

object of class sts (including the observed and the state time series)

control

Control object given as a list containing the following components:

range

Specifies the index of all timepoints which should be tested. If range is NULL all possible timepoints are used.

X
trend

Boolean indicating whether a linear trend term should be included in the model for the expectation the log-scale

season

Boolean to indicate wheather a cyclic spline should be included.

alpha

The threshold for declaring an observed count as an aberration is the (1-alpha)*100% quantile of the predictive posterior.

mc.munu
mc.y

Number of samples of y to generate for each par of the mean and size parameter. A total of mc.munu*mc.y samples are generated.

verbose

Argument sent to the inla call. When using ESS it might be necessary to force verbose mode for INLA to work.

multicore

Detect using parallel::detectCores how many logical cores are available and set INLA to use this number.

samplingMethod

Should one sample from the parameters joint distribution (joint) or from their respective marginal posterior distribution (marginals)?

Details

Note: This function requires presence of the INLA R package, which is NOT available from CRAN. It can can be downloaded by calling source("http://www.math.ntnu.no/inla/givemeINLA.R") as described in detail at http://www.r-inla.org/download.

WARNING: This function is currently experimental!! It also heavily depends on the INLA package so changes here might affect the operational ability of the function. Since the computations for the Bayesian GAM are quite involved do not expected this function to be particularly fast. Future work could focus on improving the speed, e.g. one issue would be to make the inference work in sequential fashion.

Author(s)

J. Manitz, M. Höhle, M. Salmon

References

Bayesian model algorithm for monitoring reported cases of campylobacteriosis in Germany (2013), Manitz J and Höhle M, Biometrical Journal, 55(4), pp. 509 526.

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
  #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)

  ## Not run: 
  #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, samplingMethod = "joint")

  #Apply the boda algorithm in its simples form, i.e. spline is
  #described by iid random effects and no extra covariates
  library("INLA")  # needs to be attached
  cam.boda1 <- boda(cam.sts, control=control)

  if(!inherits(cam.boda1,'try-error')){
    plot(cam.boda1,xlab='time [weeks]', ylab='No. reported',dx.upperbound=0)
  }

  
## End(Not run) 

jimhester/surveillance documentation built on May 19, 2019, 10:33 a.m.