Compute Moran's I using a subset of sample collected within the extent of a mapunit. This is likely an under-estimate of SA because we are including pixels both inside/outside MU delineations

Moran_I_ByRaster(
  r,
  mu.extent = NULL,
  n = NULL,
  k = NULL,
  do.correlogram = FALSE,
  cor.order = 5,
  crop.raster = TRUE
)

Arguments

r

single SpatRaster

mu.extent

SpatVector representation of mapunit polygons bounding box (via terra::ext())

n

number of regular samples (what is a reasonable value?)

k

number of neighbors used for weights matrix

do.correlogram

compute correlogram?

cor.order

order of correlogram

crop.raster

optionally disable cropping of the raster layer

Value

If do.correlogram is TRUE a list with estimated Moran's I ($I) and the correlogram ($correlogram), otherwise the estimated Moran's I value.

Details

This function uses the spdep::moran.test() function

Author

D.E. Beaudette