moran {spatialRF} | R Documentation |
Moran's I test
Description
Computes the spatial correlation coefficient (Moran's I) of a vector given a distance matrix, and a distance threshold used to define "neighborhood".
Usage
moran(
x = NULL,
distance.matrix = NULL,
distance.threshold = NULL,
verbose = TRUE
)
Arguments
x |
Numeric vector, generally model residuals, Default: |
distance.matrix |
Distance matrix among cases in |
distance.threshold |
numeric value in the range of values available in |
verbose |
Logical, if |
Details
Inspired in the Moran.I()
function of the ape package.
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.
See Also
Examples
if(interactive()){
#loading example data
data(distance_matrix)
data(plant_richness)
#Moran's I of the response variable
out <- moran(
x = plant_richness$richness_species_vascular,
distance.matrix = distance_matrix
)
out
}