# Re: st: Rolling calendar estimates

 From Nick Winter To statalist@hsphsun2.harvard.edu Subject Re: st: Rolling calendar estimates Date Tue, 22 Mar 2005 14:13:32 -0500

```I believe -mvsumm- will give you what you want.

. ssc describe mvsumm

to see a description

--Nick Winter

At 02:00 PM 3/22/2005 -0500, you wrote:
```
Hello,

I have a dataset of companies' stock returns on a daily basis. It is easy to calculate the standard deviation of the returns for each company per year, using:

egen sigma = sd(ret), by (firmyear)

However, if I wish to do a rolling estimate giving the standard deviation of the last actual rather than calendar year (e.g. if today is 22 March I want the standard deviation from 22 Mar 04 to 21 Mar 05, not from 1 Jan 04 to 31 Dec 05), is there an easy way to do that? If I know there are 252 trading days per year, can I just ask it to calculate the std dev of the last 252 options? I'd like to do something like

egen sigma = sd(ret[_n-252]:ret[_n-1]) if firm[_n-252] == firm[_n]

but it doesn't seem to allow anything like that.

Many thanks,
Yvonne

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar ­ get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

*
* 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/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government nw53@cornell.edu e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601

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