Description Usage Arguments Details Value Author(s) References See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 | 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"))
|
sts |
object of class sts (including the |
control |
Control object given as a
|
The following steps are perfomed according to the Farrington et al. (1996) paper.
Fit of the initial model with intercept, time trend if trend
is TRUE
,
seasonal factor variable if noPeriod
is bigger than 1, and population offset if
populationOffset
is TRUE
. Initial estimation of mean and
overdispersion.
Calculation of the weights omega (correction for past outbreaks) if reweighting
is TRUE
.
The threshold for reweighting is defined in control
.
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 using the model to compute a quantile of the predictive distribution.
The method used depends on thresholdMethod
, this can either be:
One assumes that the prediction error (or a transformation of the prediction
error, depending on powertrans
), is normally distributed. The threshold is deduced from a quantile of
this normal distribution using the variance and estimate of the expected
count given by GLM, and the delta rule. The procedure takes into account both the estimation error (variance of the estimator
of the expected count in the glm) and the prediction error (variance of the prediction error). This is the suggestion
in Farrington et al. (1996).
One assumes that the new count follows a negative binomial distribution parameterized by the expected count and the overdispersion estimated in the GLM. The threshold is deduced from a quantile of this discrete distribution. This process disregards the estimation error, though. This method was used in Noufaily, et al. (2012).
One also uses the assumption of the negative binomial sampling distribution but does not plug in the estimate of the expected count from the GLM, instead one uses a quantile from the asymptotic normal distribution of the expected count estimated in the GLM; in order to take into account both the estimation error and the prediction error.
Computation of exceedance score
Warning: monthly data containing the last day of each month as date should be analysed with epochAsDate=FALSE
in the sts
object. Otherwise February makes it impossible to find some reference time points.
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)
:
is a vector of Booleans indicating whether a time trend was fitted for this time point.
is a vector giving the coefficient of the time trend in the GLM for this time point. If no trend was fitted it is equal to NA.
is a vector giving the probability of observing a value at least equal to the observation under the null hypothesis .
is a vector giving the expectation of the predictive distribution for each timepoint. It is only reported if the conditions for raising an alarm are met, e.g enoughCases.
is a vector giving what is inputed in the negative binomial distribution to get the upperbound as a quantile (either a plug-in from the glm or a quantile from the asymptotic normal distribution of the estimator)
is a vector giving the overdispersion of the glm at each timepoint.
M. Salmon, 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, 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.
algo.farrington.fitGLM
,algo.farrington.threshold
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ### 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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.