[R-sig-Geo] Importing data into spdep package
Michael Haenlein
haenlein at gmail.com
Sat Jun 23 13:41:53 CEST 2007
Dear all,
I'm quite new to spatial statistics, so I hope the question I'm asking
is not to stupid. But I'm struggling with the issue for days now ...
I want to estimate a spatial simultaneous autoregressive lag model
using the spdep package in R. My data is currently stored in an Access
database. There I have two tables. The first one contains information
about each location. Assume one of these variables is y. Each location
is identified by a unique ID. Hence, the first table is structured in
the form "ID - y". The second table contains the distance between
pairs of location and is structured in the form "ID1 - ID2 - Distance
between ID1 and ID2".
My question is: How can I import my two tables in R and convert the
second one (giving distances between two locations) in a spatial
weights matrix? I want to estimate a model of form: y = a + bWy, where
W is a spatial weights matrix and y is a location characteristic as
defined above. I am familiar with importing data into R in general
(using the read.csv function) as well as with exporting data from
Access into csv format.
Thanks very much for your help in advance,
Michael
More information about the R-sig-Geo
mailing list