Skip to content
Prev 8635 / 29559 Next

question about autocov_dist function in "spdep" package

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:
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:
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