Spatial Autocorrelation (Descriptive Analysis)
To do the things described in this entry, you need a spatial data set and a neighborhood matrix in form of a listw
object (see neigbors and weight matrices).
Moran's I and related measures
moran.test(my-spatial-data$varX, my-lw-object.lw, zero.policy=T)
will compute the observed value of Moran's I, the value expected in the absence of any spatial autocorrelation, and a 'standardized' value, i.e. the cofficient divided by its standard error.
moran.mc(my-spatial-data$varX, my-lw-object.lw, 999)
will compute another test of Moran's I: The observed value is tested against a number of random permutations.
Lagged mean (Moran) plot
A visualization of Moran's I can be obtained by plotting the observed values of y against the mean of the y values of each observation's neighbors. This is called a 'lagged mean plot' or simply 'Moran plot'.
moran.plot(my-spatial-data$varX, my-lw-object.lw, labels=as.character(my-spatial-data$identify))
The last option used here, labels=as.character(my-spatial-data$identify)
, induces R to display a character variable to identify objects of particular influence on the value of Moran's I.
© W. Ludwig-Mayerhofer, R Guide | Last update: 20 Sep 2016