From solmaz.ahmadi at ut.ac.ir Thu Sep 18 16:00:24 2014 From: solmaz.ahmadi at ut.ac.ir (solmaz.ahmadi) Date: Thu, 18 Sep 2014 18:30:24 +0430 Subject: [Spdep-devel] Problem in creating neighbors, area and perimeter in spatial econometrics using R Message-ID: <91192011b5907c80bf86d5f0a9ee93ae@ut.ac.ir> Hi. 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: MAIN PAGE : https://sites.google.com/site/econometricsacademy/econometrics-models/spatial-econometrics DATASET : https://docs.google.com/file/d/0BwogTI8d6EEiZVdBSlgwdmFjTUk/edit?pli=1 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 `AREA`, `PERIMETER`,`ID` and `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) http://127.0.0.1:20991/library/spdep/html/columbus.html MY QUESTIONS ARE: 1. How can I use `ArcGIS` to create `AREA` and `PERIMETER` to my data file? I have some counties as samples. Are any easier solution for finding these values or I should only use `ArcGIS` for this purpose? 2. Which code pack can I use to creating neighbors based on contiguity and distance in `R`? My dependent variable is `HCI `and `Y` is latitude, `X` is longitude and other variables are independent variables. My data set framework : http://www.mediafire.com/view/lf43qm1h5ptztt6/spatial_columbus.csv Pre-defined framwwork : http://www.mediafire.com/view/ml76tbrf6p69vkf/human_capital_index.csv Thank you so much for your kind helps. -------------- next part -------------- An HTML attachment was scrubbed... URL: