TransWikia.com

On the calculus of the variable "autocov" from spdep package

Geographic Information Systems Asked by user2300 on April 6, 2021

I’m facing a spatial autocorrelation problem and I want to calculate the «  autocov» covariate through the function autocov_dist from spdep package. The problem is when I defined the neighborhood radius as twice the minimum distance to the nearest neighbor bw2as follow :

library(spded)
        knn <- spdep::knn2nb(spdep::knearneigh(xy, k=1)) # xy are in UTM
        bw <- max(unlist(spdep::nbdists(knn, xy)))
        bw2 <- 2*min(unlist(spdep::nbdists(knn, xy)))
        AUTOCOV <- spdep::autocov_dist(Data_Species[,"P_A"], xy = xy, nbs = bw2, style = "B", type = "inverse")

     
I got this error message :

 

Error in nb2listw(nb, glist = gl, style = style, zero.policy = zero.policy) :   Empty neighbour sets foundDe plus : Warning message:In spdep::autocov_dist(Data_Species[, "P_A"], xy = xy, nbs = bw2,  :  With value 135.529724518632 some points have no neighbours  

and I was obliged to use the maximum distance to the nearest neighbor bw to avoid this error but the radius here is too large. Is there any way how to manage the situation where some points have no neighbors.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP