Description Usage Arguments Value Author(s) References See Also Examples
Calculates Choynowski probability map values.
1 |
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 |
tol |
accumulate values for observed counts >= expected until value less than tol |
legacy |
default FALSE using vectorised alternating side |
A data frame with columns:
pmap |
Poisson probability map values: probablility of getting a more “extreme” count than actually observed, one-tailed with less than expected and more than expected folded together |
type |
logical: TRUE if observed count less than expected |
Roger Bivand Roger.Bivand@nhh.no
Choynowski, M (1959) Maps based on probabilities, Journal of the American Statistical Association, 54, 385–388; Cressie, N, Read, TRC (1985), Do sudden infant deaths come in clusters? Statistics and Decisions, Supplement Issue 2, 333–349; Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow: Longman, pp. 300–303.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | example(auckland)
res <- choynowski(auckland$M77_85, 9*auckland$Und5_81)
resl <- choynowski(auckland$M77_85, 9*auckland$Und5_81, legacy=TRUE)
all.equal(res, resl)
rt <- sum(auckland$M77_85)/sum(9*auckland$Und5_81)
ch_ppois_pmap <- numeric(length(auckland$Und5_81))
side <- c("greater", "less")
for (i in seq(along=ch_ppois_pmap)) {
ch_ppois_pmap[i] <- poisson.test(auckland$M77_85[i], r=rt,
T=(9*auckland$Und5_81[i]), alternative=side[(res$type[i]+1)])$p.value
}
all.equal(ch_ppois_pmap, res$pmap)
res1 <- probmap(auckland$M77_85, 9*auckland$Und5_81)
table(abs(res$pmap - res1$pmap) < 0.00001, res$type)
lt005 <- (res$pmap < 0.05) & (res$type)
ge005 <- (res$pmap < 0.05) & (!res$type)
cols <- rep("white", length(lt005))
cols[lt005] <- grey(2/7)
cols[ge005] <- grey(5/7)
plot(auckland, col=cols)
legend("bottomleft", fill=grey(c(2,5)/7), legend=c("low", "high"), bty="n")
|
Loading required package: sp
Loading required package: Matrix
acklnd> require(maptools)
Loading required package: maptools
Checking rgeos availability: TRUE
acklnd> auckland <- readShapePoly(system.file("etc/shapes/auckland.shp",
acklnd+ package="spdep")[1])
acklnd> auckland.nb <- poly2nb(auckland)
Warning message:
use rgdal::readOGR or sf::st_read
[1] TRUE
[1] TRUE
FALSE TRUE
FALSE 74 0
TRUE 0 93
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.