[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
jansoko@umich.edu |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: mvsumm and missing obs |

Date |
Tue, 10 Aug 2004 12:06:24 -0400 |

Dear Stata users, I have a similar question to Adrian's about -mvsumm-. Unfortunately, the proposed solution (using -tssmooth-) doesn't work as I am interested in moving variances, not moving averages. How can I get create a variable that contains the variance of the five preceding observations in a panel data set, even if one or two of the those preceding observations are missing? And how can I specify the minimum number of non-missing observations within the window? Thanks, Jan > From "Scott Merryman" <smerryman@kc.rr.com> > To <statalist@hsphsun2.harvard.edu> > Subject st: Re: mvsumm > Date Fri, 5 Mar 2004 17:29:35 -0600 > -----------------------------------------------------------------------------> --- > Adrian, > -tssmooth ma- gives missing obersvations a zero weight in calculating the > moving > average. This would seem to give you what you want. > Example: > . tsset var1 > time variable: var1, 1990 to 2003 > . tssmooth ma ma2= var2, w(4 1) > The smoother applied was > (1/5)*[x(t-4) + x(t-3) + x(t-2) + x(t-1) + 1*x(t)]; x(t)= var2 > . l > +--------------------+ > | var1 var2 ma2 | > |--------------------| > 1. | 1990 . . | > 2. | 1991 . . | > 3. | 1992 3 3 | > 4. | 1993 4 3.5 | > 5. | 1994 5 4 | > |--------------------| > 6. | 1995 5 4.25 | > 7. | 1996 4 4.2 | > 8. | 1997 6 4.8 | > 9. | 1998 5 5 | > 10. | 1999 3 4.6 | > |--------------------| > 11. | 2000 4 4.4 | > 12. | 2001 5 4.6 | > 13. | 2002 6 4.6 | > 14. | 2003 . 4.5 | > +--------------------+ > Hope this helps, > Scott ----- Original Message ----- From: "de la Garza, Adrian" <ADelagarza@imf.org> To: <statalist@hsphsun2.harvard.edu> Sent: Friday, March 05, 2004 4:23 PM Subject: st: mvsumm > Dear Stata users, > > I am using Chris Baum's and Nick Fox's -mvsumm- and I'd like to know if > there is a way to account for averages (or any other desc stats) when > there are missing observations (e.g., the way -collapse- accounts for > them). What I mean is the following: > > 1990 . > 1991 . > 1992 3 > 1993 4 > 1994 5 > 1995 5 > 1996 4 > 1997 6 > 1998 5 > 1999 3 > 2000 4 > 2001 5 > 2002 6 > 2003 . > > If I use -mvsumm- to generate 5-year moving averages, I'd like it to > even give me a number in year 1994 (when there are already 5 > observations to compute the average, even though 2 are missing--so the > generated number would be the average of 3, 4, and 5) and also in 2003 > (which would be the average of 3, 4, 5, and 6). Is this possible? > > Thank you. > Adrian > * * 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/

- Prev by Date:
**Re: st: A question about bootstrap** - Next by Date:
**st: How to estimate the sum of two estimators** - Previous by thread:
**st: RE: Q1 graphs notes command and Q2 the stata trademark** - Next by thread:
**st: How to estimate the sum of two estimators** - Index(es):

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