Computes the spatial correlation coefficient (Moran's I) of a vector given a distance matrix, and a distance threshold used to define "neighborhood".

moran(
x = NULL,
distance.matrix = NULL,
distance.threshold = NULL,
verbose = TRUE
)

## Arguments

x Numeric vector, generally model residuals, Default: NULL Distance matrix among cases in x. The number of rows of this matrix must be equal to the length of x. Default: NULL numeric value in the range of values available in distance.matrix. Distances below such threshold are set to 0. Default: NULL (which defaults to 0). Logical, if TRUE, prints a Moran's I plot. Default: TRUE

## Value

A list with three named slots:

• test: Data frame with observed and expected Moran's I values, p-value, and interpretation.

• plot: Moran's plot of the vector x against the spatial lags of x.

• plot.df: Data used in the Moran's plot.

## Details

Inspired in the Moran.I() function of the ape package.

moran_multithreshold()

## Examples

if(interactive()){

}