[R-sig-Geo] Problem with lagsarlm (spdep) with SparseM method
Gilles Spielvogel
spielvogel at dial.prd.fr
Fri Jan 28 20:31:31 CET 2005
Regarding what I asked earlier: no error occurs if there are two exogenous
variables, and it does run incredibly faster (a few seconds instead of 15
minutes or so with the eigen method).
As far as I can understand, the problem I encountered comes from a sequence
in the sub-program dosparse, which says (in a loop over the columns of x):
thisx<-x[,-i]
lm.null<-lm.fit(thisx, y)
If x has only two columns (which is the case if there is only one variable
on the right hand side), thisx has only one column at each step of the loop
and is not seen as a matrix by the lm.fit function, which returns an error.
My questions are now:
- is my interpretation right ?
- is this a bug, or is this a desired feature ?
- if this a bug, is there a way to correct it and be able to run a lagsarlm
with one exogenous variable and the SparseM method ?
Thanks in advance.
Gilles
-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch]On Behalf Of Gilles
Spielvogel
Sent: vendredi 28 janvier 2005 18:14
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] Problem with lagsarlm (spdep) with SparseM method
Hello,
when running the command:
lagsarc2<-lagsarlm(vary ~ varx , mydata, c2.listw, na.action=na.fail,
type="lag", method="SparseM", quiet=FALSE, zero.policy=TRUE)
R returns the following error:
Spatial lag model
Jacobian calculated using sparse matrix techniques using SparseM
Error in lm.fit(thisx, y) : `x' must be a matrix
The listw object I use comes originally from a queen contiguity GAL object
made with GeoDA. The command works perfectly if I use the option "eigen"
instead of "SparseM", but it takes a lot of time.
Does anyone have any idea about this problem ?
Thanks in advance for your help.
Gilles
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list