[R-sig-Geo] Computational problems with errorsarlm

Roger Bivand Roger.Bivand at nhh.no
Thu Aug 3 09:31:09 CEST 2017

Definitely your weights matrix. The matrix must be known and fixed. You should not try to use errorsarlm with only very few spatially identified grouped observations. Only use a multilevel approach, such as that in the HSAR package, see articles referenced there, or in an online  article in Spatial Statistics by Zhe Sha and coauthors at:

Roger Bivand
Norwegian School of Economics
Bergen, Norway

Fra: Javier García
Sendt: torsdag 3. august, 02.19
Emne: [R-sig-Geo] Computational problems with errorsarlm
Til: r-sig-geo at r-project.org

Hello everybody:

I am trying to estimate a spatial error model, but I am facing to several problems

1)  Running errorsarlm function the following message appears:

Warning messages:
1: In errorsarlm(y ~ z1 + z2 + z3 + z4 + z5 + z6 + z7 + z8 +  :
  inversion of asymptotic covariance matrix failed for tol.solve = 1e-10
  número de condición recíproco = 3.80991e-16 - using numerical Hessian.
2: In sqrt(fdHess[1, 1]) : Se han producido NaNs

Getting the following results:

Approximate (numerical Hessian) standard error: NaN
    z-value: NaN, p-value: NA
Wald statistic: NaN, p-value: NA

This can be easily “solved” changing tol.solve from 1.0e-10 to, for example, 1.0e-20. Doing this I get  the following results

Asymptotic standard error: 14.053
    z-value: -44.177, p-value: < 2.22e-16
Wald statistic: 1951.6, p-value: < 2.22e-16

2)  However, I have a more serious problema: the estimate of lambda does not make any sense

Lambda: -620.82, LR test value: 333.5, p-value: < 2.22e-16

Any idea about what it is happening? I am using a big dataset with 2800 observations (houses), 14 variables, and the spatial weight matrix has been constructed “by hand” with the inverse of the inter-areas distances . Moreover, several observations belong to the same area (in total we have only 10 areas). As the intra-area distance is unknown but cannot be considered zero, I calculate it as 1/(0.1*dist_min), being dist_min the distance between the corresponding area and the nearest one (idea borrowed from Pattanayak and Butry (2005) “Spatial complementarity of forest and farms: accounting for ecosystem services”, American Journal of Agricultural Economics). Could be due to my particular spatial weight matrix? Any alternative?



Departamento de Economía Aplicada III (Econometría y Estadística)

Facultad de Economía y Empresa (Sección Sarriko)

Avda. Lehendakari Aguirre



48015 BILBAO

T.: +34 601 7126

F.: +34 601 3754


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170803/d61108c3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 6359 bytes
Desc: image001.gif
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170803/d61108c3/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 6359 bytes
Desc: image001.gif
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170803/d61108c3/attachment-0001.gif>

More information about the R-sig-Geo mailing list