Kyle and Nick,
Thank you for the suggestions. This is what I have done since the last
email. Some one pointed me towards a spatial analysis software "GEODA"
- it's free, and does spatially weighted regressions. I have linked
the cross sectional version of my panel to a parcel map, after some
tinkering around, was able to use this software to create queen
contiguity weighting matrix. The weighting matrix is stored ".gal" or
".gwt" format , I currently wondering how to export the information
about neighbors back into STATA.
If my understand is correct, the weighting matrix, has i x i
dimension, i= parcel, a cell value at the intersection of row I and
column 2, takes 1 if parcel 1 is adjacent to parcel 2, and so on.
thanks,
Max
On Wed, Apr 8, 2009 at 2:07 PM, Kyle Hood <[email protected]> wrote:
> I think you are absolutely right; computing a county-level weight matrix
> without sparse matrix operators would be slow, to stay the least.
> Via Austin Nichols' post I just noticed that there is a package usswm that
> contains/computes contiguity spatial weight matrices for US states and
> counties. I would play around with that, maybe.
>
> Nick Cox wrote:
>>
>> I think that's all correct, but one extra detail may bite. For example,
>> a common size of problem is all 3000 or so counties in the USA. For
>> coding contiguities for that, you really need to have or to mimic sparse
>> matrix routines.
>> Nick [email protected]
>> Kyle Hood
>>
>> Thanks for the explanation of queen - I do recall that chess references
>> are used, now; I guess I had forgotten since I have never based a weight
>>
>> matrix on contiguity.
>>
>> I am a little confused about what the asker wants from Stata, here. He
>> says he has addresses (points), but wants a weighting matrix that depends on
>> contiguity, which only makes sense for areal data. If these addresses
>> contain the areas in question (for example, zip codes or states) then no
>> geocoding is necessary -- one must simply extract the areas from the address
>> data. However, after that, the information concerning which areas are
>> adjacent to others is needed. I can't imagine that Stata can be used to
>> obtain this information. If the asker
>>
>> has this information already, then it would of course be trivial to
>> program the weighting matrix in Stata (using Mata or not).
>>
>> If the addresses do not contain the areas in question (for example, the
>> asker wishes to consider adjacent census tracts, but has street address
>> data), then the address information will have to be geocoded. The geocoded
>> data must then be matched up with a map of census tracts based on location.
>> In addition, information on which census tracts were adjacent would be
>> needed, and this presents the same problem as above.
>>
>> Some of this can be done in Stata, but there are pieces that other
>> software is better suited to deal with.
>>
>> Nick Cox wrote:
>>
>>>
>>> The queen terminology in spatial analysis comes via chess.
>>> Imagine squares on a chessboard.
>>> A queen can enter a neighbouring square either across a length of
>>> boundary (over a link or edge in a boundary network) or diagonally (if
>>> two areas touch at a vertex or node in a boundary network).
>>> A rook or castle is limited to the first of those.
>>> In chess there are of course also other rules but they do not enter
>>> here.
>>> Thus "queen" implies contiguity wide sense and "rook" strict sense.
>>> The terminology goes back at least as far as the work of geographer
>>> Andrew Cliff and econometrician-statistician Keith Ord in the late
>>> 1960s.
>>> In terms of the question, I implemented weighting matrices via string
>>> variables [!!!] in -spautoc- on SSC in 1997, but I'd do it in Mata
>>>
>>
>> now,
>>
>>>
>>> but I don't have detailed advice, let alone code.
>>> Nick [email protected]
>>> Kyle Hood
>>>
>>>
>>> I'm not sure what "first-order queen contiguity" is, but you will
>>> probably have to geocode address data (geocode: address->lat/lon), and
>>>
>>
>> I
>>
>>>
>>> don't think you can do this in Stata (that is, unless the breadth of
>>> Stata's capabilities is larger than I had realized, which is sometimes
>>>
>>
>>
>>>
>>> the case). Try ArcGIS. Once you have the geocoded data, you can
>>> probably compute the weight matrix in Stata, if you want.
>>>
>>> max r wrote:
>>>
>>>
>>>>
>>>> I need to create a spatial weighting matrix (first-order queen
>>>> contiguity) for a unbalanced panel dataset. The dataset has address
>>>> information in it. Is there a way to do this in STATA? I am trying to
>>>> test for neigborhood effects in behavior. Appreciate your thoughts.
>>>>
>>>
>>> *
>>> * 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/
>>>
>>
>>
>>
>
>
> --
> Kyle Hood
> Department of Economics
> Yale University
> New Haven, CT
> website: http://www.econ.yale.edu/~kkh25/
>
> *
> * 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/
>
*
* 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/