Bookmark and Share

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


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

st: moving average in "panel" with repeated observations per unit of time


From   Partha Deb <[email protected]>
To   Statalist <[email protected]>
Subject   st: moving average in "panel" with repeated observations per unit of time
Date   Fri, 04 Mar 2011 11:41:17 -0500

I have data on transaction-level prices by neighborhood over time. I would like to create a moving average of prices for each neighborhood. As best as I understand, I cannot -xtset- or -tsset- this "panel" because there are multiple observations in a unit of time within neighborhood. There are also gaps in t (year/month). In other words, some months have multiple transactions while other months have none. How can I create an average of, say, of prices in the previous 3 months? Any ideas would be most appreciated.

An example of the dataset is below.

thanks in advance.

Partha

       +------------------------------------+
       | neighborhood       price         t |
       |------------------------------------|
    1. |         0110      275000    2003m5 |
    2. |         0110      264000    2003m6 |
    3. |         0110      425000    2003m6 |
    4. |         0110       45000    2003m7 |
    5. |         0110       60500    2003m9 |
...
   29. |        01100      198780    2005m1 |
   30. |        01100      268479    2005m2 |
       |------------------------------------|
   31. |        01100      197920    2005m3 |
   32. |        01100       32500    2005m3 |
   33. |        01100       32500    2005m3 |
   34. |        01100      263000    2005m4 |
   35. |        01100      256248    2005m4 |
...
   50. |        01101       50000    2005m4 |
       |------------------------------------|
   51. |        01101       50000    2005m4 |
   52. |        01101       50000    2005m4 |
   53. |        01101      313000    2005m6 |
   54. |        01101      295000    2005m6 |
   55. |        01101      309700   2005m12 |


--
Partha Deb
Professor of Economics
Director of Graduate Studies
Hunter College
ph:  (212) 772-5435
fax: (212) 772-5398
http://urban.hunter.cuny.edu/~deb/

Emancipate yourselves from mental slavery
None but ourselves can free our minds.
	- Bob Marley
*
*   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/


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