probmap {spdep} | R Documentation |
The function returns a data frame of rates for counts in populations at risk with crude rates, expected counts of cases, relative risks, and Poisson probabilities.
probmap(n, x, row.names=NULL, alternative="less")
n |
a numeric vector of counts of cases |
x |
a numeric vector of populations at risk |
row.names |
row names passed through to output data frame |
alternative |
default “less”, may be set to “greater” |
The function returns a data frame, from which rates may be mapped after class intervals have been chosen. The class intervals used in the examples are mostly taken from the referenced source.
raw |
raw (crude) rates |
expCount |
expected counts of cases assuming global rate |
relRisk |
relative risks: ratio of observed and expected counts of cases multiplied by 100 |
pmap |
Poisson probability map values: probablility of getting a more “extreme” count than actually observed - one-tailed, default alternative observed “less” than expected |
Roger Bivand Roger.Bivand@nhh.no
Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow: Longman, pp. 300–303.
example(auckland) res <- probmap(auckland$M77_85, 9*auckland$Und5_81) rt <- sum(auckland$M77_85)/sum(9*auckland$Und5_81) ppois_pmap <- numeric(length(auckland$Und5_81)) for (i in seq(along=ppois_pmap)) { ppois_pmap[i] <- poisson.test(auckland$M77_85[i], r=rt, T=(9*auckland$Und5_81[i]), alternative="less")$p.value } all.equal(ppois_pmap, res$pmap) brks <- c(-Inf,2,2.5,3,3.5,Inf) cols <- grey(6:2/7) plot(auckland, col=cols[findInterval(res$raw*1000, brks, all.inside=TRUE)]) legend("bottomleft", fill=cols, legend=leglabs(brks), bty="n") title(main="Crude (raw) estimates of infant mortality per 1000 per year") brks <- c(-Inf,47,83,118,154,190,Inf) cols <- cm.colors(6) plot(auckland, col=cols[findInterval(res$relRisk, brks, all.inside=TRUE)]) legend("bottomleft", fill=cols, legend=leglabs(brks), bty="n") title(main="Standardised mortality ratios for Auckland child deaths") brks <- c(0,0.05,0.1,0.2,0.8,0.9,0.95,1) cols <- cm.colors(7) plot(auckland, col=cols[findInterval(res$pmap, brks, all.inside=TRUE)]) legend("bottomleft", fill=cols, legend=leglabs(brks), bty="n") title(main="Poisson probabilities for Auckland child mortality")