[R] Error in spdep: system is computationally singular

Roger Bivand Roger.Bivand at nhh.no
Thu Oct 9 12:51:52 CEST 2008

Alberto Jiménez Valverde <ajvalv <at> ku.edu> writes:

> Hi all,
> I am trying to run an autologistic model using the function errorsarlm from
spdep package. 
> **I want to estimate the spatial simultaneous autoregressive error model**
> res20<-errorsarlm(finalglm1, listw=nb20.w, zero.policy=TRUE)
> But here I receive the following error message:
> Error in solve.default(asyvar, tol = tol.solve) : 
>   system is computationally singular: reciprocal condition number = 2.8713e-12
> What is happening? What does this message mean? 

?errorsarlm says:

     The asymptotic standard error of $lambda$ is only computed when
     method=eigen, because the full matrix operations involved would be
     costly for large n typically associated with the choice of
     method="spam" or "Matrix".  The same applies to the coefficient
     covariance matrix. Taken as the asymptotic matrix from the
     literature, it is typically badly scaled, being block-diagonal,
     and with the elements involving lambda being very small, while
     other parts of the matrix can be very large (often many orders of
     magnitude in difference). It often happens that the 'tol.solve'
     argument needs to be set to a smaller value than the default, or
     the RHS variables can be centred or reduced in range.

My guess would be that the scalings of the variables in finalglm1 are extreme 
compared to the fitted lambda. Since you don't have much control over the
RHS, just set tol.solve=1e-12 to get a result. Given that you've manipulated
the data a good deal, I wouldn't rely on the output standard errors for
inference, though.

Roger Bivand

> Thanks a lot,
> Alberto

More information about the R-help mailing list