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

Roger Bivand Roger.Bivand at nhh.no
Wed May 21 19:10:20 CEST 2008


On Wed, 21 May 2008, evans324 at umn.edu wrote:

> Thanks. I upgraded and updated everything and got a better result.

Does that mean that you get a sensible lambda for your model now - the 
line search leads somewhere other than a boundary of the interval?

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

There are different traditions. Econometricians and some others in social 
science try to trick the standard errors by "magic", while epidemiologists 
(and crime people) typically use case weights - that is model the 
heteroscedasticity directly. spautolm() can include such case weights. I 
don't think that there is any substantive and reliable theory for 
adjusting the SE, that is theory that doesn't appeal to assumptions we 
already know don't hold. Sampling from the posterior gives a handle on 
this, but is not simple, and doesn't really suit 10K observations.

> It looks as 
> though I would use the adj.se=TRUE in the summary method to get corrected 
> standard errors. Is this correct?

No, it simply adjusts the SE for (n-k) rather than ML (n), to match the 
results in Waller and Gotway chapter 9, nothing more.

Hope this helps,

Roger

> Thank you for your help.
>
> Heather
>
> 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 
>> 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