localmoran               package:spdep               R Documentation

_L_o_c_a_l _M_o_r_a_n'_s _I _s_t_a_t_i_s_t_i_c

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

     The local spatial statistic Moran's I is calculated for each zone
     based on the spatial weights object used. The values returned
     include a Z-value, and may be used as a diagnostic tool. The
     statistic is:

 I_i = frac{(x_i-bar{x})}{{sum_{k=1}^{n}(x_k-bar{x})^2}/n}{sum_{j=1}^{n}w_{ij}(x_j-bar{x})}

     , and its expectation and variance are given in Anselin (1995).

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

     localmoran(x, listw, zero.policy=FALSE, na.action=na.fail, 
             alternative = "greater", p.adjust.method="none", spChk=NULL)

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

       x: a numeric vector the same length as the neighbours list in
          listw

   listw: a 'listw' object created for example by 'nb2listw'

zero.policy: if TRUE assign zero to the lagged value of zones without
          neighbours, if FALSE assign NA

na.action: a function (default 'na.fail'), can also be 'na.omit' or
          'na.exclude' - in these cases the weights list will be
          subsetted to remove NAs in the data. It may be necessary to
          set zero.policy to TRUE because this subsetting may create
          no-neighbour observations. Note that only weights lists
          created without using the glist argument to 'nb2listw' may be
          subsetted. If 'na.pass' is used, zero is substituted for NA
          values in calculating the spatial lag. (Note that na.exclude
          will only work properly starting from R 1.9.0, na.omit and
          na.exclude assign the wrong classes in 1.8.*)

alternative: a character string specifying the alternative hypothesis,
          must be one of greater (default), less or two.sided.

p.adjust.method: a character string specifying the probability value
          adjustment for multiple tests, default "none"; see
          'p.adjustSP'. Note that the number of multiple tests for each
          region is only taken as the number of neighbours + 1 for each
          region, rather than the total number of regions.

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

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

      Ii: local moran statistic

    E.Ii: expectation of local moran statistic

  Var.Ii: variance of local moran statistic

    Z.Ii: standard deviate of local moran statistic

    Pr(): p-value of local moran statistic

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

     Roger Bivand Roger.Bivand@nhh.no

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

     Anselin, L. 1995. Local indicators of spatial association,
     Geographical Analysis, 27, 93-115; Getis, A. and Ord, J. K. 1996
     Local spatial statistics: an overview. In P. Longley and M. Batty
     (eds) _Spatial analysis: modelling in a GIS environment_
     (Cambridge: Geoinformation International), 261-277.

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

     'localG'

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

     data(afcon)
     oid <- order(afcon$id)
     resI <- localmoran(spNamedVec("totcon", afcon), nb2listw(paper.nb))
     printCoefmat(data.frame(resI[oid,], row.names=afcon$name[oid]), check.names=FALSE)
     hist(resI[,5])
     resI <- localmoran(spNamedVec("totcon", afcon), nb2listw(paper.nb), p.adjust.method="bonferroni")
     printCoefmat(data.frame(resI[oid,], row.names=afcon$name[oid]), check.names=FALSE)
     hist(resI[,5])
     totcon <- spNamedVec("totcon", afcon)
     is.na(totcon) <- sample(1:length(totcon), 5)
     totcon
     resI.na <- localmoran(totcon, nb2listw(paper.nb), na.action=na.exclude,
      zero.policy=TRUE)
     if (class(attr(resI.na, "na.action")) == "exclude") {
      print(data.frame(resI.na[oid,], row.names=afcon$name[oid]), digits=2)
     } else print(resI.na, digits=2)
     resG <- localG(spNamedVec("totcon", afcon), nb2listw(include.self(paper.nb)))
     print(data.frame(resG[oid], row.names=afcon$name[oid]), digits=2)

