Last chance! 50% off unlimited learning
Sale ends in
range
values of the surveillance time
series 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,
reweight=TRUE,verbose=FALSE,alpha=0.01,trend=TRUE,limit54=c(5,4),
powertrans="2/3",
fitFun=c("algo.farrington.fitGLM.fast","algo.farrington.fitGLM",
"algo.farrington.fitGLM.populationOffset")))
observed
and the state
time series.)SurvRes
.algo.farrington.fitGLM
,algo.farrington.threshold
#Read Salmonella Agona data
data("salmonella.agona")
#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.
plot(res,disease="Salmonella Agona",method="Farrington")
#Generate random data and convert into sts object
set.seed(123)
x <- matrix(rpois(1000,lambda=1),ncol=1)
sts <- new("sts", observed=x, epoch=1:nrow(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=c(500:1000),
fitFun="algo.farrington.fitGLM.fast")))
system.time( sts2 <- farrington(sts, control=list(range=c(500:1000),
fitFun="algo.farrington.fitGLM")))
#Check if results are the same
sum(upperbound(sts1) - upperbound(sts2))
Run the code above in your browser using DataLab