[R-sig-Geo] error message when running errorsarlm

Roger Bivand Roger.Bivand at nhh.no
Tue May 20 22:28:27 CEST 2008


On Tue, 20 May 2008, evans324 at umn.edu wrote:

> Thanks for your response.  Here's what I have now. 
> On May 20 2008, Roger Bivand wrote:
>
>> A bit more context would help. The output of sessionInfo() at least (R and 
>> package versions may matter), plus the preceding code, including the 
>> definition of rams_dak.dnear3k.listw - is it row-standardised? 
>
> Output of sessionInfo():
> R version 2.6.1 (2007-11-26) i386-pc-mingw32 
> locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
> States.1252;LC_MONETARY=English_United 
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base 
> other attached packages:
> [1] spdep_0.4-17 Matrix_0.999375-5 lattice_0.17-2 spam_0.13-2 boot_1.2-30 
> maptools_0.7-7
> [7] foreign_0.8-23    sp_0.9-23         tripack_1.2-11    car_1.2-7 
>
> loaded via a namespace (and not attached):
> [1] grid_2.6.1  tools_2.6.1

If you cannot upgrade R to 2.7.0, and Matrix to >= 0.999375-9 and spdep to 
current, try method="spam". To benefit from "Matrix", you need a fully 
updated system, running update.packages() frequently. The results are not 
trustworthy, because the NAs are pushing lambda to the upper limit of its 
interval. The default interval is OK for your setting - the weights are 
row-standardised.

Roger

>
> Preceding code:
> rams_dak <-readShapePoly("rams_dak_6May.shp", IDvar="ID", verbose=TRUE)
> rn<-sapply(slot(rams_dak, "polygons"), function(x) slot(x, "ID"))
> rams_dak.dnear.nb <- dnearneigh(coords, 0, 2500, row.names=rn)
> rams_dak.dnaer.listw <- nb2listw(rams_dak.dnear.nb, zero.policy=TRUE)
>
>
>>  Running traceback() immediately after the error would also be helpful to
>>  see where in functions called by sar.error.f.M() the problem is occurring.
>
> I get:
> 2: stop(gettextf("no method or default for coercing \"%s\" to \"%s\"", 
> thisClass, Class), domain = NA)
> 1: as((I - lambda * csrw), "dsCMatrix")
>
>>  If I understand correctly, the error messages cycle, but the
>>  rams_dak3k.err >object is created?
> Yes.
>
>> Could you run it with quiet=FALSE, so see the function values as they are 
>> generated in optimize()? The NAs usually come from the  interval= being too 
>> broad wrt. your weights style.
>
> I did this and found that lambda ranged from -.2364499 to .999 with SSEs 
> starting at 292.339 and going to 267.4409. I a bit unsure of how to select 
> and interval. Can you offer some advice on this?
>
> Thanks for your help.
>
> Heather
>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, 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