Skip to content

Error in spdep: system is computationally singular (lagsarlm)

2 messages · Paolo Veneri, Roger Bivand

#
I am trying to estimate a SAR model with the lagsarlm function:

SAR3nn <- lagsarlm(formula=formula(mod1),listw=list3nn.listw,type="lag",
method="eigen", data=d)

but I saw this message:

Error in solve.default(inf, tol = tol.solve) :
  system is computationally singular: reciprocal condition number =
5.74163e-27

It happens with both a k-nearest-neighbors matrix and with a distance matrix.
If I opt for a spatial 2sls model, the result is the same. I must say that
in the formula I have a variable and its square, which are very highly
correlated (about 0.9). The IV model works if I drop the squared variable,
while the lagsarlm still tells me that the system is singular.

Does anybody can help me? Thank you so much!

Paolo
#
On Wed, 18 Apr 2012, Paolo Veneri wrote:

            
Please see the details in ?lagsarlm, and also refer to the entry for 
argument tol.solve=. It isn't just the high correlation of your variables, 
but also their scaling with respect to the response and/or the spatial 
coefficient. Using a different method= (say "LU") and using a power trace 
vector trs= may get you there too, but re-scaling the variable will also 
re-scale its square. The same problem affects the STSLS - re-scale the 
variable. If these are say in Euro, use thousand, million or whatever Euro 
instead, for example.

Hope this helps,

Roger