eire                  package:spdep                  R Documentation

_E_i_r_e _d_a_t_a _s_e_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     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. The original Cliff and Ord
     binary contiguities are in eire.nb.

_U_s_a_g_e:

     data(eire)

_F_o_r_m_a_t:

     This data frame contains the following columns:

     _A Percentage of sample with blood group A

     _t_o_w_n_s Towns/unit area

     _p_a_l_e Beyond the Pale 0, within the Pale 1

     _s_i_z_e number of blood type samples

     _R_O_A_D_A_C_C arterial road network accessibility in 1961

     _O_W_N_C_O_N_S percentage in value terms of gross agricultural output of 
          each county consumed by itself

     _P_O_P_C_H_G 1961 population as percentage of 1926

     _R_E_T_S_A_L_E value of retail sales 000

     _I_N_C_O_M_E total personal income 000

_S_o_u_r_c_e:

     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: <URL:
     http://geog-www.sbs.ohio-state.edu/faculty/tiefelsdorf/GeoStat.htm
     >.

_E_x_a_m_p_l_e_s:

     data(eire)
     summary(eire.df$A)
     brks <- round(fivenum(eire.df$A), digits=2)
     cols <- rev(heat.colors(4))
     library(maptools)
     plot(eire.polys.utm,
      col=cols[findInterval(eire.df$A, brks)], forcefill=FALSE)
     title(main="Percentage with blood group A in Eire")
     legend(x=c(-50, 70), y=c(6120, 6050), leglabs(brks), fill=cols, bty="n")
     plot(eire.polys.utm, forcefill=FALSE)
     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)
     brks <- c(min(res),-2,-1,0,1,2,max(res))
     cols <- rev(cm.colors(6))
     plot(eire.polys.utm, col=cols[findInterval(res, brks)], forcefill=FALSE)
     title(main="Regression residuals")
     legend(x=c(-50, 70), y=c(6120, 6050), legend=leglabs(brks), fill=cols,
       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")
     brks <- round(fivenum(eire.df$OWNCONS), digits=2)
     cols <- grey(4:1/5)
     plot(eire.polys.utm,
      col=cols[findInterval(eire.df$OWNCONS, brks)], forcefill=FALSE)
     title(main="Percentage own consumption of agricultural produce")
     legend(x=c(-50, 70), y=c(6120, 6050), legend=leglabs(brks),
       fill=cols, 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)
     brks <- c(min(res),-2,-1,0,1,2,max(res))
     cols <- rev(cm.colors(6))
     plot(eire.polys.utm, col=cols[findInterval(res, brks)], forcefill=FALSE)
     title(main="Regression residuals")
     legend(x=c(-50, 70), y=c(6120, 6050), legend=leglabs(brks), 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)))

