Learn R Programming

spdep (version 0.1-10)

eire: Eire data sets

Description

The eire.df data frame has 26 rows and 9 columns. In addition, polygons of the 26 counties are provided as a multipart polylist in eire.polys.utm (coordinates in km, projection UTM zone 30). Their centroids are in eire.coords.utm, and their bounding boxes in eire.bbs.utm. The original Cliff and Ord binary contiguities are in eire.nb.

Usage

data(eire)

Arguments

source

Upton and Fingleton 1985, - Bailey and Gatrell 1995, ch. 1 for blood group data, Cliff and Ord (1973), p. 107 for remaining variables (also after O'Sullivan, 1968). Polygon borders and Irish data sourced from Michael Tiefelsdorf's SPSS Saddlepoint bundle: http://geog-www.sbs.ohio-state.edu/faculty/tiefelsdorf/GeoStat.htm.

Examples

Run this code
data(eire)summary(eire.df$A)
A.f <- as.ordered(cut(eire.df$A, breaks=fivenum(eire.df$A),
  include.lowest=TRUE))
plotpolys(eire.polys.utm, eire.bbs.utm, col=rev(heat.colors(4))[codes(A.f)])
title(main="Percentage with blood group A in Eire")
legend(x=c(-50, 70), y=c(6120, 6050), legend=levels(A.f),
  fill=rev(heat.colors(4)), bty="n")
plotpolys(eire.polys.utm, eire.bbs.utm)
plot(eire.nb, eire.coords.utm, add=TRUE)
lA <- lag.listw(nb2listw(eire.nb), eire.df$A)
summary(lA)
moran.test(spNamedVec("A", eire.df), nb2listw(eire.nb))
geary.test(spNamedVec("A", eire.df), nb2listw(eire.nb))
cor(lA, eire.df$A)
moran.plot(spNamedVec("A", eire.df), nb2listw(eire.nb),
 labels=rownames(eire.df))
A.lm <- lm(A ~ towns + pale, data=eire.df)
summary(A.lm)
res <- residuals(A.lm)
res.f <- as.ordered(cut(res, breaks=c(min(res),-2,-1,0,1,2,max(res)),
  include.lowest=TRUE))
plotpolys(eire.polys.utm, eire.bbs.utm, col=rev(cm.colors(6))[codes(res.f)])
title(main="Regression residuals")
legend(x=c(-50, 70), y=c(6120, 6050), legend=levels(res.f), fill=cm.colors(6),
  bty="n")
lm.morantest(A.lm, nb2listw(eire.nb))
lm.morantest.sad(A.lm, nb2listw(eire.nb))
lm.LMtests(A.lm, nb2listw(eire.nb), test="LMerr")owncons.f <- as.ordered(cut(eire.df$OWNCONS, breaks=fivenum(eire.df$OWNCONS),
 include.lowest=TRUE))
plotpolys(eire.polys.utm, eire.bbs.utm, col=grey(4:1/5)[codes(owncons.f)])
title(main="Percentage own consumption of agricultural produce")
legend(x=c(-50, 70), y=c(6120, 6050), legend=levels(owncons.f),
  fill=grey(4:1/5), bty="n")
moran.plot(spNamedVec("OWNCONS", eire.df), nb2listw(eire.nb))
moran.test(spNamedVec("OWNCONS", eire.df), nb2listw(eire.nb))
e.lm <- lm(OWNCONS ~ ROADACC, data=eire.df)
res <- residuals(e.lm)
res.f <- as.ordered(cut(res, breaks=c(min(res),-2,-1,0,1,2,max(res)),
  include.lowest=TRUE))
plotpolys(eire.polys.utm, eire.bbs.utm, col=rev(cm.colors(6))[codes(res.f)])
title(main="Regression residuals")
legend(x=c(-50, 70), y=c(6120, 6050), legend=levels(res.f), fill=cm.colors(6),
  bty="n")
lm.morantest(e.lm, nb2listw(eire.nb))
lm.morantest.sad(e.lm, nb2listw(eire.nb))
lm.LMtests(e.lm, nb2listw(eire.nb), test="LMerr")
print(localmoran.sad(e.lm, eire.nb, select=1:nrow(eire.df)))

Run the code above in your browser using DataLab