Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: spatgsa and converting coordinates from shp file

 From Joost Bruijsten To Subject st: spatgsa and converting coordinates from shp file Date Sat, 19 Jun 2010 08:06:42 +0000

Dear Statalisters,

my problem is about Moran's I (command: spatgsa) en the Weights matrix (spatwmat).

I use Stata/SE 11.0 for Windows (32-bit).
Born 21 October 2009

First of all, I am analyzing the urban structure of the Veneto region in Italy using commuting flows.
I want to use Moran's I to see if employment is concentrated. Employment is defined in my study as the total number of working persons that commute into a region or municipality.

Using shp files (from istat.it/ambiente/cartografia) I made the map of Veneto and the provinces and municipalities (using spmap).

Then I took the coordinates that the spmap command uses (using shp2dta) of every municipality and used the mean of the x and y coordinates for every municipality in a new dataset with the total number of ingoing commuters into a municipality. Beneath you see an example I used.

destinationprovince destinationmunicipality totalpersons x y

23 3 892 1630494 5007893

23 8 686 1633549 5013109

23 9 538 1641141 5030001

23 10 489 1648422 5032311

23 19 2463 1649542 5041687

23 20 1882 1652473 5044176

23 25 8405 1660123 5045447

23 29 471 1662310 5047371

23 44 15613 1667065 5051641

23 48 1870 1668117 5052971

23 72 1834 1668861 5053562

23 85 676 1670068 5056730

23 95 1607 1681036 5057435

I performed the commands for spatwmat and spatgsa (see beneath), although I changed the band width from a very high number (35000+) to the largest minimum distance the spatwmat command gave:

spatwmat, name(test7) xcoord(x) ycoord(y) band(0 10991)

My first question is: What is the best way with these sort of coordinates to set the band width? Or is there a way to convert these coordinates to real latitude and longitude variables? The last would actually be my preferred solution.

I then used this command to calculate Moran's I:

spatgsa totalpersons, weights(test7) moran

This gave me a result, however I do not know whether these are good given the problems. Below you see the output.

My second question is: should I standardize the spatwmat command, or use binary? I could not find in the help files what these do, in 'real' explanation.

Joost Bruijsten

. spatwmat, name(test7) xcoord(x) ycoord(y) band(0 10991)

The following matrix has been created:

1. Inverse distance weights matrix test7
Dimension: 13x13
Distance band: 0 < d <= 10991
Friction parameter: 1
Minimum distance: 950.2
1st quartile distance: 11229.2
Median distance: 21674.2
3rd quartile distance: 36380.2
Maximum distance: 70773.6
Largest minimum distance: 10990.63
Smallest maximum distance: 38792.54

.
.
. spatgsa aantalpersonen, weights(test7) moran

Measures of global spatial autocorrelation

Weights matrix
--------------------------------------------------------------
Name: test7
Type: Distance-based (inverse distance)
Distance band: 0.0 < d <= 10991.0
Row-standardized: No
--------------------------------------------------------------

Moran's I
--------------------------------------------------------------
Variables |    I      E(I)   sd(I)     z    p-value*
--------------------+-----------------------------------------
aantalpersonen | -0.189  -0.083   0.211  -0.499   0.309
--------------------------------------------------------------
*1-tail test

_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/