data(imdepi)
data(imdepifit)
# for the intensityplot we need the model environment, which can be
# easily added by the intelligent update method (no need to refit the model)
imdepifit <- update(imdepifit, model=TRUE)
## path of the total intensity
opar <- par(mfrow=c(2,1))
intensityplot(imdepifit, which="total intensity",
aggregate="time", tgrid=500)
plot(imdepi, breaks=100)
par(opar)
## path of the proportion of the epidemic component by event
intensityplot(imdepifit, which="epidemic proportion",
aggregate="time", tgrid=500, types=1)
intensityplot(imdepifit, which="epidemic proportion",
aggregate="time", tgrid=500, types=2, add=TRUE, col=2)
legend("topright", legend=levels(imdepi$events$type), lty=1, col=1:2,
title = "event type")
if (surveillance.options("allExamples") && require("maptools"))
{
## spatial shape of the intensity (aggregated over time)
# load borders of Germany's districts (obtained from the
# Bundesamt f�r Kartographie und Geod�sie, Frankfurt am Main, Germany,
# www.geodatenzentrum.de), simplified by the "special" Visvalingam
# algorithm (level=60\%) using www.MapShaper.org:
load(system.file("shapes", "districtsD.RData", package="surveillance"))
# total intensity (using a rather sparse 'sgrid' for speed)
intensityplot(imdepifit, which="total intensity",
aggregate="space", tiles=districtsD, sgrid=500)
# epidemic proportion by type
maps_epiprop <- lapply(1:2, function (type) {
intensityplot(imdepifit, which="epidemic", aggregate="space",
types=type, tiles=districtsD, sgrid=1000,
at=seq(0,1,by=0.1), col.regions=rev(heat.colors(20)))
})
plot(maps_epiprop[[1]], split=c(1,1,2,1), more=TRUE)
plot(maps_epiprop[[2]], split=c(2,1,2,1))
}
Run the code above in your browser using DataLab