Learn R Programming

spdep (version 0.5-74)

lm.morantest.exact: Exact global Moran's I test

Description

The function implements Tiefelsdorf's exact global Moran's I test.

Usage

lm.morantest.exact(model, listw, zero.policy = NULL, alternative = "greater",
 spChk = NULL, resfun = weighted.residuals, zero.tol = 1e-07, Omega=NULL,
 save.M=NULL, save.U=NULL, useTP=FALSE, truncErr=1e-6, zeroTreat=0.1)
## S3 method for class 'moranex':
print(x, \dots)

Arguments

model
an object of class lm returned by lm; weights may be specified in the lm fit, but offsets should not be used
listw
a listw object created for example by nb2listw
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
zero.tol
tolerance used to find eigenvalues close to absolute zero
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.M
return the full M matrix for use in spdep:::exactMoranAlt
save.U
return the full U matrix for use in spdep:::exactMoranAlt
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
a moranex object
...
arguments to be passed through

Value

  • A list of class moranex with the following components:
  • statisticthe value of the saddlepoint approximation of the standard deviate of global Moran's I.
  • p.valuethe p-value of the test.
  • estimatethe value of the observed global Moran's I.
  • methoda character string giving the method used.
  • alternativea character string describing the alternative hypothesis.
  • gammaeigenvalues (excluding zero values)
  • oTypeusually set to "E"
  • data.namea character string giving the name(s) of the data.
  • dfdegrees of freedom

See Also

lm.morantest.sad

Examples

Run this code
require(maptools)
eire <- readShapePoly(system.file("etc/shapes/eire.shp", package="spdep")[1],
  ID="names", proj4string=CRS("+proj=utm +zone=30 +units=km"))
eire.nb <- poly2nb(eire)
#data(eire)
e.lm <- lm(OWNCONS ~ ROADACC, data=eire)
lm.morantest(e.lm, nb2listw(eire.nb))
lm.morantest.sad(e.lm, nb2listw(eire.nb))
lm.morantest.exact(e.lm, nb2listw(eire.nb))
lm.morantest.exact(e.lm, nb2listw(eire.nb), useTP=TRUE)

Run the code above in your browser using DataLab