Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: more on spatial modeling: spatwmat


From   Julia Gamas <[email protected]>
To   [email protected]
Subject   st: more on spatial modeling: spatwmat
Date   Thu, 3 Feb 2005 14:40:36 -0500

Dear Simon,

I'm not sure about the coordinates either, but let me explain how I used
"spatwmat", in case it helps you.  Even if different from what you are doing,
it may help you understand it in the context of your own problem.
I wanted to find spatial correlation.  So I created an "adjacency" matrix with
spatwmat.  In my particular definition of adjacency, the values in the matrix
were 1 if two zones were neighbors and 0 otherwise.  This was first order
adjacency (akin to first order serial correlation in time series).  For some
biological data, second or third order adjacency can be the issue (if you're
interested not in neighbors, but neighbors of neighbors, for example).  I
created the adjacency matrix in a GIS (ArcView) and then imported it into Stata
and created the W matrix using "spatwmat".  My matrix was something like:

zone #:   1    2    3
       1  0    1    0
       2  1    0    1  
       3  0    1    0

In this example: zones 1 and 2 are neighbors and zones 2 and 3 are neighbors but
zones 1 and 3 are not (they aren't adjacent).

I then looked for spatial correlation using "spatgasa" (moran's I and a bunch of
other types of correlation that Stata tests for).  Then, when I confirmed the
presence of spatial correlation, I ran "spatreg".  You have to determine what
kind of model you are trying to run, and which question you are trying to
answer and then create the W matrix accordingly.  My knowledge about this is
limited.  To find out which W you need, you may want to consult Luc Anselin's
books and papers if you haven't done so already, and the author of the Stata
code himself.

I hope this may be of some help.

Julia

> Hi Julia,
> 
> Thanks a lot for your information. It is totally new to me that Stata 
> has commands for spatial analysis. I looked at the Stata code for 
> contracting the weighting matrix, but I am not sure the mechanism behind 
> it. Could you explain it to me, if you understand it? I mean, it seems 
> to me that the command "spatwmat" uses both y and x to construct the 
> weighting matrix, how come? It also occurs to me that each unit has only 
> one value, is that so? What exactly are the xcoord(x) and ycoord(y) 
> representing?
> 
> 
> Thanks,
> Simon

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index