# replicate Chen (2015)
data(chen)
( r <- crossCorrelation(x=chen[["X"]], y=chen[["Y"]], w = chen[["M"]],
clust=TRUE, type = "LSCI", k=0,
dist.function = "inv.power") )
# \donttest{
library(sp)
library(spdep)
data(meuse)
coordinates(meuse) <- ~x+y
#### Using a default spatial weights matrix method (inverse power function)
( I <- crossCorrelation(meuse$zinc, meuse$copper,
coords = coordinates(meuse), k=99) )
meuse$lisa <- I$SCI[,"lsci.xy"]
spplot(meuse, "lisa")
#### Providing a distance matrix
Wij <- spDists(meuse)
( I <- crossCorrelation(meuse$zinc, meuse$copper, w = Wij, k=99) )
#### Providing an inverse power function weights matrix
Wij <- spDists(meuse)
Wij <- 1 / Wij
diag(Wij) <- 0
Wij <- Wij / sum(Wij)
diag(Wij) <- 0
( I <- crossCorrelation(meuse$zinc, meuse$copper, w = Wij,
dist.function = "none", k=99) )
# }
Run the code above in your browser using DataLab