probmap: Probability mapping for rates

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/EBI.R

Description

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.

Usage

1
probmap(n, x, row.names=NULL, alternative="less")

Arguments

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”

Details

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.

Value

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

Author(s)

Roger Bivand Roger.Bivand@nhh.no

References

Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow: Longman, pp. 300–303.

See Also

EBest, EBlocal, ppois

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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")

Example output

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

spdep documentation built on Aug. 19, 2017, 3:01 a.m.