moran {spatialRF} | R Documentation |
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
)
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 |
Inspired in the Moran.I()
function of the ape package.
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.
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
}