Moran's I measure of spatial autocorrelation | R Documentation |

Moran's I measure of spatial autocorrelation.

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

`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. |

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).

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".

Michail Tsagris.

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

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
```

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.