Dear list member, I am using the autocov_dist function in spdep on binary point data set to estimate the autocovariate to be used in autologistic regression (session info at the end):
coords<-as.matrix(cbind(datafile$X_COORD, datafile$Y_COORD)) ac1 <- autocov_dist(datafile$binary_variable, coords, nbs=400, type = "inverse", zero.policy=TRUE) It works fine with large value of nbs. When nbs value is below the neibhorhood distance of some pairs of point I get warnings because of empty neighbors: >Warning messages: >1: In autocov_dist(datafile$binary_variable, coords, nbs = 400, type = >"inverse", : > With value 400 some points have no neighbours >2: In nb2listw(nb, glist = gl, style = style, zero.policy = zero.policy) : > zero sum general weights It seems, but I might be wrong, that points with no neighbour have an autocov_dist value of zero. Since it is what I want, it is ok for me. But if I decrease nbs value below the smallest neighbourhood distance among pairs of points in my data set, I get an error message: >Error in nb2listw(nb, glist = gl, style = style, zero.policy = zero.policy) : > No valid observations >In addition: Warning messages: >1: In autocov_dist(datafile$binary_variable, coords, nbs = 100, type = >"inverse", : > With value 100 some points have no neighbours >2: In nb2listw(nb, glist = gl, style = style, zero.policy = zero.policy) : > zero sum general weights My question is as follows: why do autocov_dist function require that at least one neighbor pair exists? and why not returning zero value for all points when no any point has a neighbor? This might appear to be a strange question but in my case I estimating autocov_dist for different spatial block in which the minimum distance between points vary from block to block, but still I would like a commun nbs value for all block. Thank you for your help, Julien Beguin -------------------- Ph.D. student Laval University Québec, Canada SESSION INFO: R version 2.10.1 (2009-12-14) i386-pc-mingw32 locale: [1] LC_COLLATE=French_Canada.1252 LC_CTYPE=French_Canada.1252 [3] LC_MONETARY=French_Canada.1252 LC_NUMERIC=C [5] LC_TIME=French_Canada.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] spdep_0.5-4 spam_0.20-3 coda_0.13-4 [4] deldir_0.0-12 maptools_0.7-29 foreign_0.8-40 [7] nlme_3.1-96 MASS_7.3-4 Matrix_0.999375-33 [10] lattice_0.17-26 boot_1.2-41 sp_0.9-60 [13] compositions_1.01-1 robustbase_0.5-0-1 tensorA_0.31 [16] rgl_0.91 loaded via a namespace (and not attached): [1] grid_2.10.1 tools_2.10.1 _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo