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

Re: st: RE: creating a variable for neighbors


From   Caleb Southworth <caleb@twinky.uoregon.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: creating a variable for neighbors
Date   Thu, 6 Feb 2003 16:25:13 -0800 (PST)

On Thu, 6 Feb 2003, helen milner wrote:

:I have a country-year dataset with a variable for the number of users of
:product X for each country year. There are 200 countries and 20 years. I
:would like to create a variable for country I in year t that is the
:average of its contiguous neighbors' # of users of product X in year t.
:(Unfortunately, while a country's neighbors is usually time invariant,
:it is not always time-invariant as countries are born and die).

This is a common GIS task. If you have a map of the countries at issue in
year t, then you can make a spatial contiguity matrix (for example using
the SpaceStat extension in ArcView for Windows) and then compute spatial
lag (a function of any variable in neighboring units, i.e. the average
value of product X). I compute such weights in SpaceStat and merge them
into my stata datasets for analysis. You could also compute them in STATA
directly if you have coordinates such as country centroids, see spatreg
and related commands.

Dr. Caleb Southworth, Ph.D
American Council of Learned Societies Research Fellow 2002-03
Assistant Professor
Department of Sociology
1291 University of Oregon
Eugene OR 97403
Work: (541) 346-5034
Fax:  (541) 346-5026

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index