[R-sig-Geo] Error in spdep: system is computationally singular (lagsarlm)

Roger Bivand Roger.Bivand at nhh.no
Wed Apr 18 13:01:26 CEST 2012


On Wed, 18 Apr 2012, Paolo Veneri wrote:

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

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


>
> Does anybody can help me? Thank you so much!
>
> Paolo
>
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list