View source: R/algo_farrington.R
algo.farrington  R Documentation 
Implements the procedure of Farrington et al. (1996).
At each time point of the specified range
, a GLM is fitted to
predict the counts. This is then compared to the observed
counts. If the observation is above a specific quantile of
the prediction interval, then an alarm is raised.
# original interface for a single "disProg" time series
algo.farrington(disProgObj, control=list(
range=NULL, b=5, w=3, reweight=TRUE, verbose=FALSE, plot=FALSE,
alpha=0.05, trend=TRUE, limit54=c(5,4), powertrans="2/3",
fitFun="algo.farrington.fitGLM.fast"))
# wrapper for "sts" data, possibly multivariate
farrington(sts, control=list(
range=NULL, b=5, w=3, reweight=TRUE, verbose=FALSE,
alpha=0.05), ...)
disProgObj 
an object of class 
control 
list of control parameters

sts 
an object of class 
... 
arguments for 
The following steps are performed according to the Farrington et al. (1996) paper.
fit of the initial model and initial estimation of mean and overdispersion.
calculation of the weights omega (correction for past outbreaks)
refitting of the model
revised estimation of overdispersion
rescaled model
omission of the trend, if it is not significant
repetition of the whole procedure
calculation of the threshold value
computation of exceedance score
For algo.farrington
, a list object of class "survRes"
with elements alarm
, upperbound
, trend
,
disProgObj
, and control
.
For farrington
, the input "sts"
object with updated
alarm
, upperbound
and control
slots, and subsetted
to control$range
.
M. HÃ¶hle
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, 547563.
algo.farrington.fitGLM
,
algo.farrington.threshold
An improved Farrington algorithm is available as function
farringtonFlexible
.
#load "disProg" data
data("salmonella.agona")
#Do surveillance for the last 42 weeks
n < length(salmonella.agona$observed)
control < list(b=4,w=3,range=(n42):n,reweight=TRUE, verbose=FALSE,alpha=0.01)
res < algo.farrington(salmonella.agona,control=control)
plot(res)
#Generate Poisson counts and create an "sts" object
set.seed(123)
x < rpois(520,lambda=1)
stsObj < sts(observed=x, frequency=52)
if (surveillance.options("allExamples")) {
#Compare timing of the two possible fitters for algo.farrington
range < 312:520
system.time( sts1 < farrington(stsObj, control=list(range=range,
fitFun="algo.farrington.fitGLM.fast"), verbose=FALSE))
system.time( sts2 < farrington(stsObj, control=list(range=range,
fitFun="algo.farrington.fitGLM"), verbose=FALSE))
#Check if results are the same
stopifnot(upperbound(sts1) == upperbound(sts2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.