Moran_I_ByRaster: Compute Moran's I for a raster sampled from a mapunit extent

View source: R/Moran_I_ByRaster.R

Moran_I_ByRasterR Documentation

Compute Moran's I for a raster sampled from a mapunit extent

Description

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

Usage

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

Details

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

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.

Author(s)

D.E. Beaudette


sharpshootR documentation built on Oct. 23, 2024, 1:06 a.m.