[R-sig-Geo] Dispersion term u in errorsarlm in spdep

Thomas Vladeck thomas.vladeck at gmail.com
Sun Oct 18 16:38:49 CEST 2015


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.

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

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]]



More information about the R-sig-Geo mailing list