Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

autocor

Spatial autocorrelation


Description

Compute Moran's I or Geary's C measures of global spatial autocorrelation in a RasterLayer, or compute the the local Moran or Geary index (Anselin, 1995).

Usage

Geary(x, w=matrix(c(1,1,1,1,0,1,1,1,1), 3,3))
Moran(x, w=matrix(c(1,1,1,1,0,1,1,1,1), 3,3))
MoranLocal(x, w=matrix(c(1,1,1,1,0,1,1,1,1), 3,3))
GearyLocal(x, w=matrix(c(1,1,1,1,0,1,1,1,1), 3,3))

Arguments

x

RasterLayer

w

Spatial weights defined by or a rectangular matrix with odd length (3, 5, ...) sides (as in focal)

Details

The default setting uses a 3x3 neighborhood to compute "Queen's case" indices. You can use a filter (weights matrix) to do other things, such as "Rook's case", or different lags.

Value

A single value (Moran's I or Geary's C) or a RasterLayer (Local Moran or Geary values)

Author(s)

Robert J. Hijmans and Babak Naimi

References

Moran, P.A.P., 1950. Notes on continuous stochastic phenomena. Biometrika 37:17-23

Geary, R.C., 1954. The contiguity ratio and statistical mapping. The Incorporated Statistician 5: 115-145

Anselin, L., 1995. Local indicators of spatial association-LISA. Geographical Analysis 27:93-115

See Also

The spdep package for additional and more general approaches for computing indices of spatial autocorrelation

Examples

r <- raster(nrows=10, ncols=10)
values(r) <- 1:ncell(r)

Moran(r)
# Rook's case
f <- matrix(c(0,1,0,1,0,1,0,1,0), nrow=3)
Moran(r, f)

Geary(r)

x1 <- MoranLocal(r)

# Rook's case
x2 <- MoranLocal(r, w=f)

raster

Geographic Data Analysis and Modeling

v3.4-10
GPL (>= 3)
Authors
Robert J. Hijmans [cre, aut] (<https://orcid.org/0000-0001-5872-2872>), Jacob van Etten [ctb], Michael Sumner [ctb], Joe Cheng [ctb], Dan Baston [ctb], Andrew Bevan [ctb], Roger Bivand [ctb], Lorenzo Busetto [ctb], Mort Canty [ctb], Ben Fasoli [ctb], David Forrest [ctb], Aniruddha Ghosh [ctb], Duncan Golicher [ctb], Josh Gray [ctb], Jonathan A. Greenberg [ctb], Paul Hiemstra [ctb], Kassel Hingee [ctb], Institute for Mathematics Applied Geosciences [cph], Charles Karney [ctb], Matteo Mattiuzzi [ctb], Steven Mosher [ctb], Babak Naimi [ctb], Jakub Nowosad [ctb], Edzer Pebesma [ctb], Oscar Perpinan Lamigueiro [ctb], Etienne B. Racine [ctb], Barry Rowlingson [ctb], Ashton Shortridge [ctb], Bill Venables [ctb], Rafael Wueest [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.