[Openspace] Different rho between R and GEODA
Roger Bivand
Roger.Bivand at nhh.no
Thu Nov 8 01:35:47 CST 2007
On Wed, 7 Nov 2007, Kolympiris, Christos (UMC-Student) wrote:
> Professor Bivand,
>
> Thank you for your help. After i tried the Moran's I, i realized my
> weights were different. The mistake was a careless one from my part:
Thanks - everyone does things like this, and having a saved history file
means that checking is easier.
>
> I had: listw30 <- nb2listw(w30, glist=NULL, style="B", zero.policy=TRUE) instead of
> listw30 <- nb2listw(w30, glist=NULL, style="W", zero.policy=TRUE)
>
> I don't know why i put style B since i did want a row standardized
> weight matrix.
>
> As an aside, is there a way to export the outcome of a summary statement
> besides copy and paste? I am defining my regressions as objects and i
> haven't found a way to export the outcome to a text file besides just
> copying and paste, which can be tedious.
One easy way is sink() to a text file, and working with an editor and
scripts makes it possible first to try things out, and then bracket output
with sink() commands and graphics with say png() and dev.off() commands.
Roger
>
> Thanks a lot
>
> Christos
>
> -----Original Message-----
> From: Roger Bivand [mailto:Roger.Bivand at nhh.no]
> Sent: Wed 11/7/2007 2:58 AM
> To: Kolympiris, Christos (UMC-Student)
> Cc: openspace at sal.uiuc.edu
> Subject: Re: [Openspace] Different rho between R and GEODA
>
> On Wed, 7 Nov 2007, Kolympiris, Christos (UMC-Student) wrote:
>
>>
>> Hi all,
>>
>> I was trying to double-check my spatial lag model results obtained from
>> GEODA, so i run the exact same regression in R.
>>
>> All my coefficients, signs and significance levels are approximately the
>> same except the rho coefficient which is very very different.
>>
>> Without boring you with the details of my model this is what i get:
>> under GEODA, rho is 0.3348171 while R's rho is 0.0015391.
>>
>> This is a striking difference and it made me suspicious that i was doing
>> something wrong in R since i am a new user. I did examine all my steps
>> and it appears i am not missing something, so i am wondering if the
>> problem lies in the algorithm used for each program / environment. In R
>> i am using the lagsarlm function which is using 2SLS.
>
> Please do not guess, both are maximum likelihood, the R/spdep function for
> 2SLS contributed by Luc Anselin is stsls(), not lagsarlm(). The most
> likely cause of difference is a different weights matrix - are you using
> distance weights, and have neglected to invert them from the GWT file on
> the R side?
>
> Without seeing your code and results (and software versions), it is hard
> to help. For R, you can quote verbatim your code in your message, for
> GEODA, you can quote the regression output report. For the same data and
> weights, lagsarlm() and GEODA lag results do agree. To check the weights,
> simply do a Moran's I on your dependent variable in R (moran.test()) and
> in GEODA. If they do not agree, the weights are not the same.
>
> Hope this helps,
>
> Roger
>
>>
>> Any ideas, hints or suggestions would be very helpful.
>>
>> Christos Kolympiris
>> PhD Candidate
>> Department of Agricultural Economics
>> University of Missouri - Columbia
>> _______________________________________________
>> Openspace mailing list
>> Openspace at sal.uiuc.edu
>> http://sal.uiuc.edu/mailman/listinfo/openspace
>>
>
>
--
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 Openspace
mailing list