How to calculate Moran's I

409 views
Skip to first unread message

Kaundie

unread,
Feb 15, 2010, 7:11:08 PM2/15/10
to Openspace List
Hi,

I want to know how to calculate Moran's I with GeoDa. I calculated
Moran's I with SAS but the values are different with GeoDa. Just want
to make sure that I am doing right with GeoDa.


Thanks

Roger Bivand

unread,
Feb 16, 2010, 8:59:43 AM2/16/10
to Openspace List

Most likely the spatial weights you are using differ. If they differ, the
results will not be the same. Either try to read the GeoDa GAL file into
SAS, or transfer the SAS weights to GeoDa (for example as a three column
GWT file) to cross-check. A reference to an open web page describing the
SAS implementation is also needed - very few people have access to SAS. I
don't think that SAS "comes with" this measure - is it a user
contribution, or in proc variogram?

If all SAS can output for weights is a matrix, use mat2listw() and
write.nb.gal() in the contributed package spdep in R to transit from one
th the other, or use both the SAS matrix and the GeoDa GAL file with
moran.test() in spdep/R.

If Moran's I (the estimated statistic) is the same, but the p-value
differs, note that a Monte-Carlo test is used in GeoDa, and the p-value
will vary slightly each time you run the test.

Roger

>
> Thanks
>
>

--
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....@nhh.no

Kaundie

unread,
Feb 16, 2010, 9:26:56 AM2/16/10
to Openspace List
Dear Roger,

Thanks for the answer. I am using Proc Variogram and the I have used
Inverse distance matrix where each off-diagonal entry [i, j] in the
matrix is equal to 1/(1+distance between point i and point j). I think
its better to calculate Moran's I with GeoDa. Please let me know if I
am not doing right with the GeoDa for calculating Moran's I:

1. I have excel file (data.exl) with first column I have site (1 to
224), 2nd column : A parameter values, 3rd column, latitude and 3rd
column longitude.
2. Then I opened the ArcMap and created the shapefile from the Excel
file (data.exl).
3. I opened the GeoDa and loaded the shapefile into GeoDa.
4. The I created weights (Weights creation file): Wights file ID
Variable was blank, hence I used default Poly_ID.
5. Checked K nearest neighbors to 4. or selected Threshold values by
euclidean distance. Which threshold distance I should choose?
6. Created the weighted file (text file X).
7. I opened the text file to calculate Moran's I.
7. Calculated the Moran's I which I found 0.70


Please explain me about 4 and 5 number.
Thanks

Sandeep

Kaundie

unread,
Feb 16, 2010, 9:37:33 AM2/16/10
to Openspace List
I think for calculating Moran's I for the parameter , the first column
of the table should be for which we are calculating Moran's I???

Roger Bivand

unread,
Feb 16, 2010, 10:29:12 AM2/16/10
to Openspace List
On Tue, 16 Feb 2010, Kaundie wrote:

> Dear Roger,
>
> Thanks for the answer. I am using Proc Variogram and the I have used
> Inverse distance matrix where each off-diagonal entry [i, j] in the
> matrix is equal to 1/(1+distance between point i and point j). I think
> its better to calculate Moran's I with GeoDa. Please let me know if I
> am not doing right with the GeoDa for calculating Moran's I:
>
> 1. I have excel file (data.exl) with first column I have site (1 to
> 224), 2nd column : A parameter values, 3rd column, latitude and 3rd
> column longitude.
> 2. Then I opened the ArcMap and created the shapefile from the Excel
> file (data.exl).
> 3. I opened the GeoDa and loaded the shapefile into GeoDa.
> 4. The I created weights (Weights creation file): Wights file ID
> Variable was blank, hence I used default Poly_ID.
> 5. Checked K nearest neighbors to 4. or selected Threshold values by
> euclidean distance. Which threshold distance I should choose?

Choose threshold, not K=. However, the default threshold is the shortest
distance that makes sure that all points have a neighbour, so you'll need
the largest distance between the two points furthest apart to mimic SAS.
Probably a GeoDa user can talk you through this better than I can, as I'm
currently looking at OpenGeoDa 0.9.8.14, not legacy GeoDa, and the menus
are not the same. I guess that you would not choose to use R to check out
your SAS value.

Roger

> 6. Created the weighted file (text file X).
> 7. I opened the text file to calculate Moran's I.
> 7. Calculated the Moran's I which I found 0.70
>
>
> Please explain me about 4 and 5 number.
> Thanks
>
> Sandeep
>
>

--

Reply all
Reply to author
Forward
0 new messages