Skip to content

Cost distance in spatial weight matrix

2 messages · Roozbeh Valavi, Facundo Muñoz

#
Dear list,

I wonder if it is possible to add some kind of cost/weighting when creating
a spatial weight matrix to be used in a spatial lag model? I want to
consider the effect of elevation as a cost for calculating distance to the
neighbours.
I am using spdep for creating the W and splm for the model.

Thank you in advance,
Roozbeh
#
Dear Roozbeh,

package geoRcb [1]* provides function distmatGen() [2], which computes a
cost-based distance matrix between any two sets of locations, given a
raster cost surface (such as elevation). The function uses package
gdistance to actually perform the computations, and it does not depend
on anything else in the package, so you can simply copy it to your code
base.

Is that what you were looking for?

?acu.-



[1] https://github.com/famuvie/geoRcb/

[2] https://github.com/famuvie/geoRcb/blob/master/R/distmatGen.R

* Disclaimer: I'm the author.
On 10/29/18 1:42 PM, Roozbeh Valavi wrote: