autocov_dist              package:spdep              R Documentation

_D_i_s_t_a_n_c_e-_w_e_i_g_h_t_e_d _a_u_t_o_c_o_v_a_r_i_a_t_e

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

     Calculates the autocovariate to be used in autonormal, autopoisson
     or autologistic regression. Three distance-weighting schemes are
     available.

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

     autocov_dist(z, xy, nbs = 1, type = "inverse", zero.policy = FALSE,
      style = "W", longlat=NULL)

_A_r_g_u_m_e_n_t_s:

       z: the response variable

      xy: a matrix of coordinates or a SpatialPoints object

     nbs: neighbourhood radius; default is 1

    type: the weighting scheme: "one" gives equal weight to all data
          points in the neighbourhood; "inverse" (the default) weights
          by inverse distance; "inverse.squared" weights by the square
          of "inverse"

zero.policy: If FALSE stop with error for any empty neighbour sets, if
          TRUE permit the weights list to be formed with zero-length
          weights vectors

   style: style' can take values W, B, C, U, and S; W gives mean values
          for neighbours

 longlat: TRUE if point coordinates are longitude-latitude decimal, in
          which case distances are measured in kilometers; if xy is a
          SpatialPoints object, the value is taken from the object
          itself

_V_a_l_u_e:

     A numeric vector of autocovariate values

_A_u_t_h_o_r(_s):

     Carsten F. Dormann and Roger Bivand

_R_e_f_e_r_e_n_c_e_s:

     Augustin N.H., Mugglestone M.A. and Buckland S.T. (1996) An
     autologistic model for the spatial distribution of wildlife.
     _Journal of Applied Ecology_, 33, 339-347; Gumpertz M.L., Graham
     J.M. and Ristaino J.B. (1997) Autologistic model of spatial
     pattern of Phytophthora epidemic in bell pepper: effects of soil
     variables on disease presence. _Journal of Agricultural,
     Biological and Environmental Statistics_, 2, 131-156.

_S_e_e _A_l_s_o:

     'nb2listw'

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

     example(columbus)
     xy <- cbind(columbus$X, columbus$Y)
     ac1a <- autocov_dist(columbus$CRIME, xy, nbs=10, style="W",
      type="one")
     acinva <- autocov_dist(columbus$CRIME, xy, nbs=10, style="W",
      type="inverse")
     acinv2a <- autocov_dist(columbus$CRIME, xy, nbs=10, style="W",
      type="inverse.squared")

     plot(ac1a ~ columbus$CRIME, pch=16, asp=1)
     points(acinva ~ columbus$CRIME, pch=16, col="red")
     points(acinv2a ~ columbus$CRIME, pch=16, col="blue")
     abline(0,1)

     nb <- dnearneigh(xy, 0, 10)
     lw <- nb2listw(nb, style="W")
     ac1b <- lag(lw, columbus$CRIME)
     all.equal(ac1b, ac1a)

     nbd <- nbdists(nb, xy)
     gl <- lapply(nbd, function(x) 1/x)
     lw <- nb2listw(nb, glist=gl)
     acinvb <- lag(lw, columbus$CRIME)
     all.equal(acinvb, acinva)

     gl2 <- lapply(nbd, function(x) 1/(x^2))
     lw <- nb2listw(nb, glist=gl2)
     acinv2b <- lag(lw, columbus$CRIME)
     all.equal(acinv2b, acinv2a)

     glm(CRIME ~ HOVAL + ac1b, data=columbus, family="gaussian")
     spautolm(columbus$CRIME ~ HOVAL, data=columbus,
      listw=nb2listw(nb, style="W"))

     xy <- SpatialPoints(xy)
     acinva <- autocov_dist(columbus$CRIME, xy, nbs=10, style="W",
      type="inverse")
     nb <- dnearneigh(xy, 0, 10)
     nbd <- nbdists(nb, xy)
     gl <- lapply(nbd, function(x) 1/x)
     lw <- nb2listw(nb, glist=gl)
     acinvb <- lag(lw, columbus$CRIME)
     all.equal(acinvb, acinva)

