I’m working on a
spatial cross section model with
R-programming-language. I’m running these codes which refers to
anselin data (spatial_columbus) in
spdep package. I found them from these links:
library(spdep)# Loading required package: sp &Loading required package: Matrix data(Columbus) mydata<-columbus attach(mydata) y<-cbind(CRIME) x<-cbind(INC,HOVAL) xy<-cbind(mydata$X, mydata$Y) neighbors<-col.gal.nb coords<-coords summary(neighbors)
When I used these codes for data (columbus) in
spdep package, everything is fine, but when I want apply them to my data (human capital index) I’m not able to define
neighborhood for my data . My problem is in this line
( neighbor<-col.gal.nb). it’s the neighbors list from an original
GAL-format file and it’s a pre-defined file . I don’t know any codes for creating neighbors to my data and I think my data framework is different from spatial Columbus data framework (There is
polyID columns that I don’t have these columns in my data framework).
The help link for
col.gal.nb is here (you can open this link in R environment after above codes)
My questions are here:
- How can I use
PERIMETERto my data file? I have some counties as samples. Are any easier solution for finding these values or I should only use
ArcGISfor this purpose? (In sample codes the author used
ArcGISto calculating these values).
- Which code pack can I use to creating neighbors based on contiguity and distance in
R? My dependent variable is
longitudeand other variables are independent variables.
My data set framework : http://www.mediafire.com/view/lf43qm1h5ptztt6/spatial_columbus.csv
Pre-defined framework : http://www.mediafire.com/view/ml76tbrf6p69vkf/human_capital_index.csv