# moranI: Moran's I measure of spatial autocorrelation In Rfast2: A Collection of Efficient and Extremely Fast R Functions II

 Moran's I measure of spatial autocorrelation R Documentation

## Moran's I measure of spatial autocorrelation

### Description

Moran's I measure of spatial autocorrelation.

### Usage

``````moranI(x, w, scaled = FALSE, R = 999)
``````

### Arguments

 `x` A numerical vector with observations. `w` The inverse of a (symmetric) distance matrix. After computing the distance matrix, you invert all its elements and the elements which are zero (diagonal) and have become Inf. set them to 0. This is the w matrix the functions requires. If you want an extra step, you can row standardise this matrix by dividing each row by its total. This will makw the rowsums equal to 1. `scaled` If the matrix is row-standardised (all rowsums are equal to 1) then this is TRUE and FALSE otherwise. `R` The number of permutations to use in order to obtain the permutation based-pvalue. If R is 1 or less no permutation p-value is returned.

### Details

Moran' I index is a measure of spatial autocorrelation. that was proposed in 1950. Instead of computing an asymptotic p-value we compute a permutation based p-value utilizing the fast method of Chatzipantsiou et al. (2019).

### Value

A vector of two values, the Moran's I index and its permutation based p-value. If R is 1 or less no permutation p-value is returned, and the second element is "NA".

### Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

### References

Moran, P. A. P. (1950). Notes on Continuous Stochastic Phenomena. Biometrika. 37(1): 17-23.

Chatzipantsiou C., Dimitriadis M., Papadakis M. and Tsagris M. (2019). Extremely efficient permutation and bootstrap hypothesis tests using R. Journal of Modern Applied Statistical Methods (To appear). https://arxiv.org/ftp/arxiv/papers/1806/1806.10947.pdf

```censpois.mle, gammapois.mle ```

### Examples

``````x <- rnorm(50)
w <- as.matrix( dist(iris[1:50, 1:4]) )
w <- 1/w
diag(w) <- 0
moranI(x, w, scaled = FALSE)
``````

Rfast2 documentation built on May 29, 2024, 8:45 a.m.