localmoran.exact

0th

Percentile

Exact local Moran's Ii tests

localmoran.exact provides exact local Moran's Ii tests under the null hypothesis, while localmoran.exact.alt provides exact local Moran's Ii tests under the alternative hypothesis. In this case, the model may be a fitted model returned by errorsarlm from which the covariance matrix is retrieved, or the covariance matrix can be passed through the Omega= argument.

Keywords
spatial
Usage
localmoran.exact(model, select, nb, glist = NULL, style = "W", zero.policy = NULL, alternative = "greater", spChk = NULL, resfun = weighted.residuals, save.Vi = FALSE, useTP=FALSE, truncErr=1e-6, zeroTreat=0.1) localmoran.exact.alt(model, select, nb, glist = NULL, style = "W", zero.policy = NULL, alternative = "greater", spChk = NULL, resfun = weighted.residuals, Omega = NULL, save.Vi = FALSE, save.M = FALSE, useTP=FALSE, truncErr=1e-6, zeroTreat=0.1) "print"(x, ...) "as.data.frame"(x, row.names=NULL, optional=FALSE, ...)
Arguments
model
an object of class lm returned by lm (assuming no global spatial autocorrelation), or an object of class sarlm returned by a spatial simultaneous autoregressive model fit (assuming global spatial autocorrelation represented by the model spatial coefficient); weights may be specified in the lm fit, but offsets should not be used
select
an integer vector of the id. numbers of zones to be tested; if missing, all zones
nb
a list of neighbours of class nb
glist
a list of general weights corresponding to neighbours
style
can take values W, B, C, and S
zero.policy
default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA
alternative
a character string specifying the alternative hypothesis, must be one of greater (default), less or two.sided.
spChk
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption()
resfun
default: weighted.residuals; the function to be used to extract residuals from the lm object, may be residuals, weighted.residuals, rstandard, or rstudent
Omega
A SAR process matrix may be passed in to test an alternative hypothesis, for example Omega <- invIrW(listw, rho=0.1); Omega <- tcrossprod(Omega), chol() is taken internally
save.Vi
if TRUE, return the star-shaped weights lists for each zone tested
save.M
if TRUE, save a list of left and right M products
useTP
default FALSE, if TRUE, use truncation point in integration rather than upper=Inf, see Tiefelsdorf (2000), eq. 6.7, p.69
truncErr
when useTP=TRUE, pass truncation error to truncation point function
zeroTreat
when useTP=TRUE, pass zero adjustment to truncation point function
x
object to be printed
row.names
ignored argument to as.data.frame.localmoranex; row names assigned from localmoranex object
optional
ignored argument to as.data.frame.localmoranex; row names assigned from localmoranex object
...
arguments to be passed through
Value

A list with class localmoranex containing "select" lists, each with class moranex with the following components:When the alternative is being tested, a list of left and right M products in attribute M.

See Also

lm.morantest.exact, localmoran.sad

Aliases
  • localmoran.exact
  • localmoran.exact.alt
  • print.localmoranex
  • as.data.frame.localmoranex
Examples
require(maptools)
eire <- readShapePoly(system.file("etc/shapes/eire.shp", package="spdep")[1],
  ID="names", proj4string=CRS("+proj=utm +zone=30 +ellps=airy +units=km"))
eire.nb <- poly2nb(eire)
#data(eire)
e.lm <- lm(OWNCONS ~ ROADACC, data=eire)
localmoran.sad(e.lm, nb=eire.nb)
localmoran.exact(e.lm, nb=eire.nb)
localmoran.exact(e.lm, nb=eire.nb, useTP=TRUE)
e.errorsar <- errorsarlm(OWNCONS ~ ROADACC, data=eire,
 listw=nb2listw(eire.nb))
lm.target <- lm(e.errorsar$tary ~ e.errorsar$tarX - 1)
localmoran.exact.alt(lm.target, nb=eire.nb)
Omega <- invIrW(nb2listw(eire.nb), rho=0.6)
Omega1 <- tcrossprod(Omega)
localmoran.exact.alt(lm.target, nb=eire.nb, Omega=Omega1)
localmoran.exact.alt(lm.target, nb=eire.nb, Omega=Omega1, useTP=TRUE)
Documentation reproduced from package spdep, version 0.6-9, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.