algo.cusum | R Documentation |
Approximate one-side CUSUM method for a Poisson variate based on the cumulative sum of the deviation between a reference value k and the transformed observed values. An alarm is raised if the cumulative sum equals or exceeds a prespecified decision boundary h. The function can handle time varying expectations.
algo.cusum(disProgObj, control = list(range = range, k = 1.04, h = 2.26,
m = NULL, trans = "standard", alpha = NULL))
disProgObj |
object of class disProg (including the observed and the state chain) |
control |
control object:
|
algo.cusum
gives a list of class "survRes"
which includes the
vector of alarm values for every timepoint in range
and the vector
of cumulative sums for every timepoint in range
for the system
specified by k
and h
, the range and the input object of
class "disProg"
.
The upperbound
entry shows for each time instance the number of diseased individuals
it would have taken the cusum to signal. Once the CUSUM signals no resetting is applied, i.e.
signals occurs until the CUSUM statistic again returns below the threshold.
In case control$m="glm"
was used, the returned
control$m.glm
entry contains the fitted "glm"
object.
This implementation is experimental, but will not be developed further.
M. Paul and M. Höhle
G. Rossi, L. Lampugnani and M. Marchi (1999), An approximate CUSUM procedure for surveillance of health events, Statistics in Medicine, 18, 2111–2122
D. A. Pierce and D. W. Schafer (1986), Residuals in Generalized Linear Models, Journal of the American Statistical Association, 81, 977–986
# Xi ~ Po(5), i=1,...,500
set.seed(321)
stsObj <- sts(observed = rpois(500,lambda=5))
# there should be no alarms as mean doesn't change
res <- cusum(stsObj, control = list(range = 100:500, trans = "anscombe"))
plot(res, xaxis.labelFormat = NULL)
# simulated data
disProgObj <- sim.pointSource(p = 1, r = 1, length = 250,
A = 0, alpha = log(5), beta = 0, phi = 10,
frequency = 10, state = NULL, K = 0)
plot(disProgObj)
# Test weeks 200 to 250 for outbreaks
surv0 <- algo.cusum(disProgObj, control = list(range = 200:250))
plot(surv0, xaxis.years = FALSE)
# alternatively, using the newer "sts" interface
stsObj <- disProg2sts(disProgObj)
surv <- cusum(stsObj, control = list(range = 200:250))
plot(surv)
stopifnot(upperbound(surv) == surv0$upperbound)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.