Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: computing standard deviations


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Re: computing standard deviations
Date   Sat, 24 Jan 2004 10:56:36 -0500

On Jan 24, 2004, at 2:33 AM, Adrian wrote:

And what I need is to take the standard deviation by country and for
every two consecutive quarters and store that number in the following
quarter. So, eventually, I will convert the dataset given in monthly
frequency (as shown) to quarterly frequency. I was thinking of taking,
by country and for every row, the standard dev of the previous six
observations, and then lag everything by three months and then collapse
everything into quarters. But I don't know how to take the std devs...

Something like this is what I could do, except that I know the -in- part
is not syntactically correct:

by country: egen stdev = sd(xgrth) in xgrth[_n-5]/xgrth

any ideas?
The SSC routine mvsumm (Cox and Baum) does just that. ssc describe mvsumm for details.

Kit

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




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