[R-sig-Geo] fitting lag model in R

Roger Simon Bivand Roger.Bivand at nhh.no
Mon Dec 31 12:49:25 CET 2012


Please read ?lagsarlm under the tol.solve= item:

the tolerance for detecting linear dependencies in the columns of matrices to be inverted - passed to \code{solve()} (default=1.0e-10). This may be used if necessary to extract coefficient standard errors (for instance lowering to 1e-12), but errors in \code{solve()} may constitute indications of poorly scaled variables: if the variables have scales differing much from the autoregressive coefficient, the values in this matrix may be very different in scale, and inverting such a matrix is analytically possible by definition, but numerically unstable; rescaling the RHS variables alleviates this better than setting tol.solve to a very small value

Does that help?

--
Roger Bivand
NHH Norwegian School of Economics
Helleveien 30, 5045 Bergen, Norway
Roger.Bivand at nhh.no


________________________________________
Fra: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] på vegne av Milan Sharma [milansharma2012 at yahoo.com]
Sendt: 29. desember 2012 7:43
To: r-sig-geo at r-project.org
Emne: [R-sig-Geo] fitting lag model in R

Hi all,
can any one of you see whats wrong in the code below?
>  model<-lm(Tcrash~X100MVMT+Alcohol+Alignment+PVMT, data=data)#works
> sar<-spautolm(Tcrash~X100MVMT+Alcohol+Alignment+PVMT,listw=WI_queenW, data=data)#works
> lag <- lagsarlm(Tcrash~X100MVMT+Alcohol+Alignment+PVMT, data=data, listw=listwW)#shows error
Error in solve.default(inf, tol = tol.solve) :
  system is computationally singular: reciprocal condition number = 2.44638e-12
> lag <- lagsarlm(Tcrash~X100MVMT+Alcohol+Alignment+PVMT, data=data, listw=WI_queenW)
Error in solve.default(inf, tol = tol.solve) :
  system is computationally singular: reciprocal condition number = 1.51647e-13
> WI_queenW
Characteristics of weights list object:
Neighbour list object:
Number of regions: 71
Number of nonzero links: 364
Percentage nonzero weights: 7.22079
Average number of links: 5.126761

Weights style: B
Weights constants summary:
   n   nn  S0  S1   S2
B 71 5041 364 728 8160
.............................
 Milan
        [[alternative HTML version deleted]]




More information about the R-sig-Geo mailing list