Learn R Programming

surveillance (version 1.7-0)

farringtonFlexible: Surveillance for an univariate count data time series using the improved Farrington method described in Noufaily et al. (2012).

Description

The function takes range values of the surveillance time series sts and for each time point uses a Poisson GLM with overdispersion to predict an upper bound on the number of counts according to the procedure by Farrington et al. (1996) and by Noufaily et al. (2012). This bound is then compared to the observed number of counts. If the observation is above the bound, then an alarm is raised.

Usage

farringtonFlexible(sts, control = list(range = NULL, b = 3, w = 3,
                                      reweight = TRUE, 
                                      weightsThreshold = 2.58,
                                      verbose = FALSE,glmWarnings = TRUE,
                                      alpha = 0.01, trend = TRUE,
                                      pThresholdTrend = 0.05, limit54=c(5,4), 
                                      powertrans="2/3",
                                      fitFun="algo.farrington.fitGLM.flexible",
                                      populationOffset = FALSE, 
                                      noPeriods = 1, pastWeeksNotIncluded = 26, 
                                      thresholdMethod = "delta"))

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: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object O

Value

  • An object of class sts with the slots upperbound and alarm filled by appropriate output of the algorithm. The slot control is the usual list but with more items all of length length(range): [object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

encoding

latin1

Details

The following steps are perfomed according to the Farrington et al. (1996) paper.
  1. Fit of the initial model with intercept, time trend iftrendisTRUE, seasonal factor variable ifnoPeriodis bigger than 1, and population offset ifpopulationOffsetisTRUE. Initial estimation of mean and overdispersion.
  2. Calculation of the weights omega (correction for past outbreaks) ifreweightingisTRUE. The threshold for reweighting is defined incontrol.
  3. Refitting of the model
  4. Revised estimation of overdispersion
  5. Omission of the trend, if it is not significant
  6. Repetition of the whole procedure
  7. Calculation of the threshold value using the model to compute a quantile of the predictive distribution. The method used depends onthresholdMethod, this can either be:[object Object],[object Object],[object Object]
  8. Computation of exceedance score

References

A statistical algorithm for the early detection of outbreaks of infectious disease, Farrington, C.P., Andrews, N.J, Beale A.D. and Catchpole, M.A. (1996), J. R. Statist. Soc. A, 159, 547-563. An improved algorithm for outbreak detection in multiple surveillance systems, Noufaily, A., Enki, D.G., Farrington, C.P., Garthwaite, P., Andrews, N.J., Charlett, A. (2012), Statistics in Medicine, published online.

See Also

algo.farrington.fitGLM,algo.farrington.threshold

Examples

Run this code
### DATA I/O ###
#Read Salmonella Agona data
data("salmonella.agona")

# Create the corresponding sts object from the old disProg object
salm <- disProg2sts(salmonella.agona)

### RUN THE ALGORITHMS WITH TWO DIFFERENT SETS OF OPTIONS ###           
# Farrington with old options
control1 <-  list(range=(260:312),
						 noPeriods=1,populationOffset=FALSE,
						 fitFun="algo.farrington.fitGLM.flexible",
						 b=4,w=3,weightsThreshold=1,
						 pastWeeksNotIncluded=3,
						 pThresholdTrend=0.05,trend=TRUE,
						 thresholdMethod="delta",alpha=0.1)
control2<-   list(range=(260:312),
						 noPeriods=10,populationOffset=FALSE,
						 fitFun="algo.farrington.fitGLM.flexible",
						 b=4,w=3,weightsThreshold=2.58,
						 pastWeeksNotIncluded=26,
						 pThresholdTrend=1,trend=TRUE,
						 thresholdMethod="delta",alpha=0.1)
salm1 <- farringtonFlexible(salm,control=control1)
salm2 <- farringtonFlexible(salm,control=control2)

### PLOT THE RESULTS ###
y.max <- max(upperbound(salm1),observed(salm1),upperbound(salm2),na.rm=TRUE)
 
plot(salm1,ylim=c(0,y.max),
        main='S. Newport in Germany')
lines( 1:(nrow(salm1)+1)-0.5, 
       c(upperbound(salm1),upperbound(salm1)[nrow(salm1)]),
      type="s",col='tomato4',lwd=2)
lines( 1:(nrow(salm2)+1)-0.5, 
       c(upperbound(salm2),upperbound(salm2)[nrow(salm2)]),
      type="s",col="blueviolet",lwd=2)

legend(c(0,10),c('Alarm','Upperbound with old options','Upperbound with new options'),
      pch=c(24,NA,NA),lty=c(NA,1,1),
        bg="white",lwd=c(2,2,2),col=c('red','tomato4',"blueviolet"))

Run the code above in your browser using DataLab