1
$\begingroup$

I want to create a spatially lagged version of my response variable to estimate a spatial autoregressive model in R. To quantify the spatial relationship that exists among the features in my data I have used Generate Network Spatial Weights-tool in ArcMap. Basically, this tool defines the feature spatial relationships based on an underlying network structure (a street network in my case). The problem is that output from the Generate Network Spatial Weights-tool is a Spatial Weight Matrix file (.swm), which I don't know how to use in R. I, therefore, wonder if someone knows:

  1. Is there any package in R that support .swm files or is there a way to convert the .swm file into a format that is easier to handle in R, such as .gal or .gwt format?

  2. Is there any package or function in R that allows me to define the feature spatial relationships based on an underlying network structure similar to the Generate Network Spatial Weights-tool in ArcMap?

Any help is appreciated.

$\endgroup$
2
  • 1
    $\begingroup$ I recall looking at these .swm files about a decade ago, so I'm hazy on the details, but my memory is that (1) they are in a simple, easily read format; (2) you can figure out that format fairly quickly by looking at the Python source code for the tool that generates these files; and (3) you don't really need to know Python. Strategically it may be a good idea to use ArcMap to generate these files and read them into R (rather than generating them in R) because that's a good division of labor: let the GIS do the spatial calculations, then hand the ball to R for the analysis. $\endgroup$
    – whuber
    Commented Dec 6, 2017 at 15:51
  • $\begingroup$ Thanks for your answer, whuber. I will have a look at it and see if I can figure it out. I also found out that there actually is a tool in ArcMap that converts .swm files to .dbf files, maybe that will make it easier for me. $\endgroup$
    – m.ras
    Commented Dec 7, 2017 at 13:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.