algo.farrington: Surveillance for a count data time series using the...
The function takes
range values of the surveillance time
disProgObj and for each time point uses a GLM to
predict the number of counts according to the procedure by
Farrington et al. (1996). This is then compared to the observed
number of counts. If the observation is above a specific quantile of
the prediction interval, then an alarm is raised.
algo.farrington(disProgObj, control=list(range=NULL, b=3, w=3,
object of class disProgObj (including the
observed and the
state time series.)
Specifies the index of all timepoints which
should be tested. If range is
NULL the maximum number
of possible weeks is used (i.e. as many weeks as possible while
still having enough reference values).
how many years back in time to include when
forming the base counts.
windows size, i.e. number of weeks to include
before and after the current week
Boolean specifying whether to perform reweight step
true a trend is included and kept in
case the conditions documented in Farrington et al. (1996) are met
(see the results). If
false then NO trend is fit.
Boolean indicating whether to show extra debugging information.
Boolean specifying whether to show the final GLM model fit graphically (use
History|Recording to see all pictures).
Power transformation to apply to the
data. Use either "2/3" for skewness correction (Default),
"1/2" for variance stabilizing transformation or "none" for no
An approximate (two-sided) (1-α)
prediction interval is calculated.
To avoid alarms in cases where the time series only
has about 0-2 cases the algorithm uses the following heuristic
criterion (see Section 3.8 of the Farrington paper) to protect
against low counts: no alarm is sounded if fewer than
cases=5 reports were received in the past period=4
limit54=c(cases,period) is a vector allowing the
user to change these numbers. Note: As of version 0.9-7 the
term "last" period of weeks includes the current week -
otherwise no alarm is sounded for horrible large numbers if
the four weeks before that are too low.
String containing the name of the fit
function to be used for fitting the GLM. The options are
algo.farrington.fitGLM.fast (default) and
algo.farrington.fitGLM.populationOffset. See details of
algo.farrington.fitGLM for more information.
The following steps are performed according to the Farrington
et al. (1996) paper.
fit of the initial model and initial estimation of mean and
calculation of the weights omega (correction for past outbreaks)
refitting of the model
revised estimation of overdispersion
omission of the trend, if it is not significant
repetition of the whole procedure
calculation of the threshold value
computation of exceedance score
An object of class
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.
#Read Salmonella Agona data
#Do surveillance for the last 100 weeks.
n <- length(salmonella.agona$observed)
#Set control parameters.
control <- list(b=4,w=3,range=(n-100):n,reweight=TRUE, verbose=FALSE,alpha=0.01)
res <- algo.farrington(salmonella.agona,control=control)
#Plot the result.
## Not run:
#Generate Poisson counts and convert into an "sts" object
x <- rpois(520,lambda=1)
sts <- sts(observed=x, state=x*0, freq=52)
#Compare timing of the two possible fitters for algo.farrington (here using S4)
system.time( sts1 <- farrington(sts, control=list(range=312:520,
system.time( sts2 <- farrington(sts, control=list(range=312:520,
#Check if results are the same
stopifnot(upperbound(sts1) == upperbound(sts2))
## End(Not run)