[R-sig-Geo] A global autocorrelation statistic for categorical data?

Pedro Perez perep1972 @end|ng |rom gm@||@com
Tue Feb 16 12:14:51 CET 2021


Hello everybody!

Sorry for the dumb question, I have very limited experience with regards to
spatial autocorrelation. I have a lot of spatial points for which I
measured both continuous and categorical variables. I need to calculate
*global* measures of spatial autocorrelation for both kinds of variables. I
know that this task is relatively easy for continuous ones, here an example
using the package elsa:

rm(list = ls())
library(raster)
library(elsa)

dta <- data.frame(Lon = (runif(60)*100),
                              Lat = (runif(60)*100),
                              Cat = sample(LETTERS[1:5], 60, replace = T),
                              Cont = (runif(60)*100))
coordinates(dta) <- ~Lon + Lat
# Moran's I global index:
moran(dta[,2], d1=0, d2=2000)
[1] -0.01694915 # The value varies given that seed was not set
# Geary's c global index:
geary(dta[,2], d1=0, d2=2000)
[1] 1

That is, I need something like the moran or geary commands in the previous
example, but applicable to categorical covariates. I have been googleing
for a while, but I have not been able to find a solution. Any idea?


Thanks in advance!


Perep
ResponderReenviar

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list