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]

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


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: moving average in "panel" with repeated observations per unit of time
Date   Fri, 4 Mar 2011 17:27:08 +0000

See if this helps:

SJ-7-3  pr0033  . . . . . . . . . . . . . .  Stata tip 51: Events in intervals
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q3/07   SJ 7(3):440--443                                 (no commands)
        tip for counting or summarizing irregularly spaced
        events in intervals

Nick

On Fri, Mar 4, 2011 at 4:41 PM, Partha Deb <[email protected]> wrote:

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

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