[R-sig-Geo] Dispersion term u in errorsarlm in spdep
Roger Bivand
Roger.Bivand at nhh.no
Mon Oct 19 11:44:16 CEST 2015
On Sun, 18 Oct 2015, Thomas Vladeck wrote:
> Hi,
>
> I'm working on a marketing project, and could use a bit of technical help
> and advice. I'm trying to model the spatial interdependence of a product's
> usage (my dependent variable is the amount of usage in a given zip code
> [1]) through a spatial error model, which is of the form:
>
> y = Xb + u // u = λWu + e // e ~ N(0, σ^2)
>
> In *Bayesian Statistics and Marketing* [2] the dispersion vector u is
> interpreted as the "influence" of one unit over those it's related to via
> the weighting matrix. Extracting this would be helpful from a marketer's
> perspective as it would be advantageous to promote usage in an influential
> area.
>
> I have two questions:
>
> First, is this a reasonable interpretation of the dispersion vector? It's
> not clear to me that this is a reasonable interpretation.
This would be a spatially structured random effect, as distinct from an
unstructured random effect in this context. See LeSage & Pace (2009) for
more details.
>
> Second, I'm using the errorsarlm function in spdep and I'd like to extract
> u from the returned object. According to the documentation, it does not
> seem that u is returned directly. Can I calculate it as follows?
>
> u = λWu + e
> u = (I - λW)^(-1) * e
>
The (legacy) predict method for sarlm objects reports a spatial signal, as
distinct from the spatial trend (X \beta). Work is ongoing to fold recent
work, including the GSoC 2015 project, on prediction into spdep.
Roger
PS. Your comment about data size shows that you have not examined the
method= argument to errorsarlm() - method="Matrix" will work for large
sparse symmetric spatial neighbour graphs. However, your "distance.matrix"
object may not be sparse - just full of lots of very small values which
could without loss be set to zero.
> Which would be the following in code:
>
> W <- mat2listw(
> distance.matrix,
> style = "W"
> )
>
> error.sp.model <- errorsarlm(
> formula = fm,
> data = model.data[, -1],
> listw = W
> )
>
> lambda <- error.sp.model$lambda
>
> # (I - λW)^-1
> inv.W <- ginv((diag(1, nrow(distance.matrix)) - lambda *
> distance.matrix))
>
> # the result i'm looking for
> u <- inv.W %*% as.vector(error.sp.model$residuals)
>
>
> Thanks so much! Really appreciate the help.
>
> Tom
>
>
> [1] Actually, the average across all zip codes that start with the same
> first three digits. (I needed to do this to make the problem
> computationally tractable
> [2] http://www.perossi.org/home/bsm-1
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list