data("momo")
momo
## show the period 2000-2008 with customized x-axis annotation
## (this is Figure 1 in Hoehle and Mazick, 2010)
oopts <- surveillance.options("stsTickFactors" = c("%G" = 1.5, "%Q"=.75))
plot(momo[year(momo) >= 2000,], ylab = "", xlab = "Time (weeks)",
par.list = list(las = 1), col = c(gray(0.5), NA, NA),
xaxis.tickFreq = list("%G"=atChange, "%Q"=atChange),
xaxis.labelFreq = list("%G"=atChange), xaxis.labelFormat = "%G")
surveillance.options(oopts)
if (surveillance.options("allExamples")) {
## stratified monitoring from 2007-W40 using the Farrington algorithm
phase2 <- which(epoch(momo) >= "2007-10-01")
momo2 <- farrington(momo, control = list(range=phase2, alpha=0.01, b=5, w=4))
colSums(alarms(momo2))
plot(momo2, col = c(8, NA, 4), same.scale = FALSE)
## stripchart of alarms (Figure 5 in Hoehle and Mazick, 2010)
plot(momo2, type = alarm ~ time, xlab = "Time (weeks)", main = "",
alarm.symbol = list(pch=3, col=1, cex=1.5))
}
Run the code above in your browser using DataLab