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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Re: mvsumm |

Date |
Sun, 7 Mar 2004 16:55:16 -0000 |

As for -mvsumm-, I would take the matter up with the authors Chris Baum and Nick Fox. But looking at the code and the help makes me think that the answer is No, so Scott's solution is the one to follow; unless you copy -mvsumm- and make it behave the way you want. Nick n.j.cox@durham.ac.uk Scott Merryman > -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 | > +--------------------+ > de la Garza, Adrian > > 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? * * 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: superimpose 45 degree line in -scatter-** - Next by Date:
**RE: st: superimpose 45 degree line in -scatter-** - Previous by thread:
**RE: st: superimpose 45 degree line in -scatter-** - Next by thread:
**st: RE: Re: mvsumm** - Index(es):

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