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: RE: Standard deviation of variable between dates
From
Joseph Monte <[email protected]>
To
[email protected]
Subject
Re: st: RE: Standard deviation of variable between dates
Date
Thu, 16 Sep 2010 10:06:57 -0400
This is as far as I got:-
tsset revfdate_1
rolling sigma=r(sd), clear recursive window(1): summarize vwretd, detail
Unfortunately, this only runs for the first revfdate1 (i.e. 02jan1996)
(in other words 2556 observations). My dates run from 02jan1996 -
31dec2002, so I guess I should have 2556 x 2556 observations.
start end sigma
02jan1996 02jan1996
02jan1996 03jan1996 .0047819
02jan1996 04jan1996 .0071548
02jan1996 05jan1996 .0058503
02jan1996 06jan1996 .0058503
02jan1996 07jan1996 .0058503
02jan1996 08jan1996 .0052703
02jan1996 09jan1996 .0080427
02jan1996 10jan1996 .0088304
02jan1996 11jan1996 .0093549
02jan1996 12jan1996 .0087719
02jan1996 13jan1996 .0087719
02jan1996 14jan1996 .0087719
02jan1996 15jan1996 .0083129
02jan1996 16jan1996 .0087911
etc
Thanks,
Hugh
On Tue, Sep 14, 2010 at 2:12 PM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> Have you tried -rolling-?
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Joseph Monte
> Sent: Dienstag, 14. September 2010 19:57
> To: statalist
> Subject: st: Standard deviation of variable between dates
>
> Hi Statalisters,
>
> Based on the table below, I need the standard deviation of vwretd
> between revfdate1[_n+1] (i.e. not including revfdate1) and offerdate1
> while revfdate1[_n+`i']<=offerdate1, where i goes from 1 to 300
> (basically the max length between revfdate1 and offerdate1 is 300).
> So, using obs 23 as an example, I want the std dev of -.00223069 and
> .00704247. to be entered alongside obs 23 in a new variable. This new
> variable should similarly contain all the resulting std deviations.
> So, based on the table, there would be three std dev values ( obs 8,
> 14 & 23). I hope my explanation is clear.
>
> | revfdate1 offerdate1 vwretd |
> |------------------------------------|
> 1. | 02jan1996 . .00661722 |
> 2. | 03jan1996 . -.00014537 |
> 3. | 04jan1996 . -.0076854 |
> 4. | 05jan1996 . -.00103026 |
> 5. | 08jan1996 . .00268481 |
> |------------------------------------|
> 6. | 09jan1996 . -.0158739 |
> 7. | 10jan1996 . -.01555297 |
> 8. | 11jan1996 20mar1996 .00843481 |
> 9. | 12jan1996 . -.00099131 |
> 10. | 15jan1996 . -.0052766 |
> |------------------------------------|
> 11. | 16jan1996 . .01000137 |
> 12. | 17jan1996 . -.00052036 |
> 13. | 18jan1996 . .00378893 |
> 14. | 19jan1996 07feb1996 .0056981 |
> 15. | 22jan1996 . .00429229 |
> |------------------------------------|
> 16. | 23jan1996 . -8.435e-06 |
> 17. | 24jan1996 . .01023512 |
> 18. | 25jan1996 . -.00367997 |
> 19. | 26jan1996 . .00624507 |
> 20. | 29jan1996 . .00404597 |
> |------------------------------------|
> 21. | 30jan1996 . .00915902 |
> 22. | 31jan1996 . .00800156 |
> 23. | 01feb1996 05feb1996 .00463789 |
> 24. | 02feb1996 . -.00223069 |
> 25. | 05feb1996 . .00704247 |
> |------------------------------------|
> 26. | 06feb1996 . .00684131 |
> 27. | 07feb1996 . .00349892 |
> 28. | 08feb1996 . .00772813 |
>
>
> Thanks,
>
> Joe
> *
> * 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/
>
> *
> * 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/
>
*
* 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/