Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: spatgsa and converting coordinates from shp file

From   Maurizio Pisati <>
Subject   Re: st: spatgsa and converting coordinates from shp file
Date   Sat, 19 Jun 2010 10:45:03 +0200

The bandwidth for computing Moran's I should be set to any value that makes sense to your research problem. In your case, coordinates appear to be expressed in meters, so that option -band(0 10991) means that you are defining the neighbors of every municipality j as the set of municipalities whose centers are within a radius of 11 kilometers from the center of j. If this definition doesn't suit your needs, than you can extend the bandwidth the way you deem more appropriate to your research problem. Likewise, choosing a binary or a non-binary spatial weight matrix -- standardized or not -- depends on the way you want to define spatial contiguity between municipalities (see related literature for more info on spatial weight matrices).
Best wishes,
Maurizio Pisati

Il 19/06/10 10.06, Joost Bruijsten ha scritto:

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

Thanks for your consideration,

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.
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index