## Script to compute the codispersion map using kernel estimation library(fields) # required to see the output image # Warning: this operation could take a long time lenx <- length(x) leny <- length(y) Mcodisp <- matrix(0, ncol = leny, nrow = lenx) for (i in 1:lenx) { for (j in 1:leny) Mcodisp[i,j] <- codisp.kern(x, y, c(x[i], y[j]), h)[4] } image.plot(x, y, Mcodisp, col = topo.colors(128), ylab = "", xlab = "", main = "Codispersion map")