View source: R/algo_outbreakP.R
algo.outbreakP  R Documentation 
Frisen and Andersson (2009) method for semiparametric surveillance of outbreaks
algo.outbreakP(disProgObj, control = list(range = range, k=100,
ret=c("cases","value"),maxUpperboundCases=1e5))
disProgObj 
object of class disProg (including the observed and the state chain). 
control 
A list controlling the behaviour of the algorithm

A generalized likelihood ratio test based on the Poisson distribution is implemented where the means of the incontrol and outofcontrol states are computed by isotonic regression.
OutbreakP(s) = \prod_{t=1}^s \left( \frac{\hat{\mu}^{C1}(t)}{\hat{\mu}^D(t)} \right)^{x(t)}
where \hat{\mu}^{C1}(t)
is the estimated mean obtained by
unimodal regression under the assumption of one changepoint and
\hat{\mu}^D(t)
is the estimated result when there is no
changepoint (i.e. this is just the mean of all observations). Note
that the contrasted hypothesis assume all means are equal until the
changepoint, i.e. this detection method is especially suited for
detecting a shift from a relative constant mean. Hence, this is less
suited for detection in diseases with strong seasonal endemic
component. Onset of influenza detection is an example where this
method works particular well.
In case control$ret == "cases"
then a brute force numerical
search for the number needed before alarm (NNBA) is performed. That
is, given the past observations, what's the minimum number which would
have caused an alarm? Note: Computing this might take a while because
the search is done by sequentially increasing/decreasing the last
observation by one for each time point in control$range
and
then calling the workhorse function of the algorithm again. The argument
control$maxUpperboundCases
controls the upper limit of this
search (default is 1e5).
Currently, even though the statistic has passed the threshold, the NNBA
is still computed. After a few time instances what typically happens is
that no matter the observed value we would have an alarm at this time point. In this case the value of NNBA is set to NA
. Furthermore, the first time
point is always NA
, unless k<1
.
algo.outbreakP
gives a list of class survRes
which
includes the vector of alarm values for every timepoint in
range
, the vector of threshold values for every timepoint
in range
.
M. Höhle – based on Java code by M. Frisen and L. Schiöler
The code is an extended R port of the Java code by Marianne
Frisén and Linus Schiöler from the
Computer Assisted Search For Epidemics (CASE) project,
formerly available from https://case.folkhalsomyndigheten.se/
under the GNU GPL License v3.
An additional feature of the R code is that it contains a search for NNBA (see details).
Frisén, M., Andersson and Schiöler, L., (2009), Robust outbreak surveillance of epidemics in Sweden, Statistics in Medicine, 28(3):476493.
Frisén, M. and Andersson, E., (2009) Semiparametric Surveillance of Monotonic Changes, Sequential Analysis 28(4):434454.
#Use data from outbreakP manual (http://www.hgu.gu.se/item.aspx?id=16857)
y < matrix(c(1,0,3,1,2,3,5,4,7,3,5,8,16,23,33,34,48),ncol=1)
#Generate sts object with these observations
mysts < sts(y, alarm=y*0)
#Run the algorithm and present results
#Only the value of outbreakP statistic
upperbound(outbreakP(mysts, control=list(range=1:length(y),k=100,
ret="value")))
#Graphical illustration with numberneededbeforealarm (NNBA) upperbound.
res < outbreakP(mysts, control=list(range=1:length(y),k=100,
ret="cases"))
plot(res,dx.upperbound=0,lwd=c(1,1,3),legend.opts=list(legend=c("Infected",
"NNBA","Outbreak","Alarm"),horiz=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.