[R-sig-Geo] Error message --- stsls and lagsarlm!
Roger Bivand
Roger.Bivand at nhh.no
Thu Sep 3 08:06:32 CEST 2015
On Wed, 2 Sep 2015, Qiuhua Ma wrote:
> Hi,
>
> I run spatial lag model with k nearest neighbor weight matrix using both
> stsls and lagsarlm!
>
> I tried k=4:
>
>> nb4nwuisale <- knn2nb(knearneigh(sales.nonwuidata.sp, k = 4))
>
>> knn4nwuilistws <- nb2listw(nb4nwuisale, style="W")
>
>
> #stsls method
>> sp.lagsls.knn4nwuilistws <- stsls(fm_comrisk, data=sales.nonwuidata.sp,
> knn4nwuilistws)
> Error in base::chol2inv(x, ...) :
> element (89, 89) is zero, so the inverse cannot be computed
>
> #ML method
>> sp.lagml.knn4nwuilistws <- lagsarlm(fm_comrisk, data=sales.nonwuidata.sp,
> knn4nwuilistws)
> Warning messages:
> 1: In lagsarlm(fm1, data = sales.nonwuidata.sp, knn4nwuilistws) :
> inversion of asymptotic covariance matrix failed for tol.solve = 1e-10
> reciprocal condition number = 3.30065e-13 - using numerical Hessian.
> 2: In sqrt(diag(fdHess)[-1]) : NaNs produced
>
> I also tried other weight matrix but got the same error message. Any
> suggestions on how to deal with the error/warning message...
Since the problem does not appear to come from the weights, it probably
comes from the data. Could you look at the VIFs in a regular lm() to see
whether your covariates are close to collinear? Your formulae do not
indicate how many columns there are in the model matrix (89 is a large
number - are many of the RHS variables factors, are you using many
dummies?).
Running traceback() after the failure in stsls() would show the context of
the error.
Roger
>
> thanks,
>
> Chelsea
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list