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

st: RE: Computing standard deviations


From   "de la Garza, Adrian" <[email protected]>
To   <[email protected]>
Subject   st: RE: Computing standard deviations
Date   Sat, 24 Jan 2004 11:30:06 -0500

Yes, Nick. Thanks. I discovered your mvsumm command yesterday a bit after I sent that message. It's great!


-----Original Message-----
From:	Nick Cox on behalf of Nick Cox
Sent:	Sat 1/24/2004 10:26 AM
To:	[email protected]
Cc:	
Subject:	RE: Computing standard deviations

Check out -mvsumm- from SSC and see if it will help. 

Nick 
[email protected] 

de la Garza, Adrian
 
> Anyone has an idea on how to do the following...? 
> 
> I have a dataset in panel format country-time, where time is given in
> monthly frequency. I need to take standard deviations of six-month
> periods within a same variable and then put the results in 
> the following
> quarter. This is what I have:
> 
>           country   year   month   quar       xgrth
>         Argentina   1990       1      1     .104022  
>         Argentina   1990       2      1    .1645495  
>         Argentina   1990       3      1    .5374349  
>        Bangladesh   1990       8      3    .2717893  
>        Bangladesh   1990       9      3    .3432341  
>        Bangladesh   1990      10      4    .2450083  
>        Bangladesh   1990      11      4    .1813706  
>        Bangladesh   1990      12      4    .1414036  
> 
> 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


<<winmail.dat>>




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