EBlocal: Local Empirical Bayes estimator

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

View source: R/EBI.R

Description

The function computes local empirical Bayes estimates for rates "shrunk" to a neighbourhood mean for neighbourhoods given by the nb neighbourhood list.

Usage

1
EBlocal(ri, ni, nb, zero.policy = NULL, spChk = NULL, geoda=FALSE)

Arguments

ri

a numeric vector of counts of cases the same length as the neighbours list in nb

ni

a numeric vector of populations at risk the same length as the neighbours list in nb

nb

a nb object of neighbour relationships

zero.policy

default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA

spChk

should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption()

geoda

default=FALSE, following Marshall's algorithm as interpreted by Bailey and Gatrell, pp. 305-307, and exercise 8.2, pp. 328-330 for the definition of phi; TRUE for the definition of phi used in GeoDa (see discussion on OpenSpace mailing list June 2003: http://agec221.agecon.uiuc.edu/pipermail/openspace/2003-June/thread.html)

Details

Details of the implementation are to be found in Marshall, p. 286, and Bailey and Gatrell p. 307 and exercise 8.2, pp. 328–330. The example results do not fully correspond to the sources because of slightly differing neighbourhoods, but are generally close.

Value

A data frame with two columns:

raw

a numerical vector of raw (crude) rates

est

a numerical vector of local empirical Bayes estimates

and a parameters attribute list with components:

a

a numerical vector of local phi values

m

a numerical vector of local gamma values

Author(s)

Roger Bivand Roger.Bivand@nhh.no, based on contributions by Marilia Carvalho

References

Marshall R M (1991) Mapping disease and mortality rates using Empirical Bayes Estimators, Applied Statistics, 40, 283–294; Bailey T, Gatrell A (1995) Interactive Spatial Data Analysis, Harlow: Longman, pp. 303–306.

See Also

EBest, probmap

Examples

1
2
3
4
5
6
7
example(auckland)
res <- EBlocal(auckland$M77_85,  9*auckland$Und5_81, auckland.nb)
brks <- c(-Inf,2,2.5,3,3.5,Inf)
cols <- grey(6:2/7)
plot(auckland, col=cols[findInterval(res$est*1000, brks, all.inside=TRUE)])
legend("bottomleft", fill=cols, legend=leglabs(brks), bty="n")
title(main="Local moment estimator of infant mortality per 1000 per year")

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 

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