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

evans324 at umn.edu evans324 at umn.edu
Wed May 21 17:13:56 CEST 2008

Thanks. I upgraded and updated everything and got a better result. However, 
I'm not 100% sure that I'm using the correct command to accomplish what I 
need to accomplish. My OLS model has significant spatial autocorrelation 
(RLMlag is not significant and RLMerror is) and heteroscedasticity. I had 
hoped to use errorsarlm then run White's standard errors to address this, 
but I find that hccm(car) requires a .lm object. Looking through old 
threads, I found one that suggests using spautolm is such situations. Does 
spautolm address both spatial autocorrelation and heteroscedasticity? It 
looks as though I would use the adj.se=TRUE in the summary method to get 
corrected standard errors. Is this correct? Thank you for your help.


On May 20 2008, Roger Bivand wrote:

>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 
>> 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

Heather Sander
Ph.D. Candidate:  Conservation Biology
Office:  305 Ecology & 420 Blegen
University of Minnesota
Dept. of Geography
414 Social Science Bldg.
267 19th Ave. S.
Minneapolis, MN 55455

More information about the R-sig-Geo mailing list