moran.randtest: Function to compute Moran's index of spatial autocorrelation

View source: R/moran.randtest.R

moran.randtestR Documentation

Function to compute Moran's index of spatial autocorrelation

Description

This function computes Moran's I statistic and provide a testing procedure using random permutations. It is based on the moran.mc function of the spdep package. The moran.randtest is slightly different as it allows to consider several variables (x can have more than one columns) and its ouputs are objects of class randtest (one variable) or krandtest (several variables).

Usage

moran.randtest(x, listw, nrepet = 999, ...)

Arguments

x

a vector, matrix or data.frame with numeric data

listw

an object of class listw created for example by nb2listw

nrepet

an integer indicating the number of permutations used in the randomization procedure

...

other arguments to be passed to the as.randtest or as.krandtest functions.

Value

An object of class randtest (one variable) or krandtest (several variables)

Author(s)

Stéphane Dray stephane.dray@univ-lyon1.fr

References

Moran, P. A. P. (1950). Notes on continuous stochastic phenomena. Biometrika, 37, 17-23.

See Also

moran.mc

Examples


if(require("ade4", quietly = TRUE)  & require("spdep", quiet = TRUE)){
data(mafragh)
tests <- moran.randtest(mafragh$env, nb2listw(mafragh$nb))
tests
plot(tests)

}


sdray/adespatial documentation built on Jan. 26, 2024, 8:22 a.m.