Bookmark and Share

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: Grand mean


From   Phil Clayton <[email protected]>
To   [email protected]
Subject   Re: st: Grand mean
Date   Tue, 15 Mar 2011 11:10:29 +1100

Use egen, eg:

egen grand_mean=mean(mean), by(id vis)
egen grand_mean_roi=mean(mean), by(id vis roi)

Phil

On 15/03/2011, at 11:04 AM, Debs Majumdar wrote:

> Hello Statalisters,
> 
>  I have a longitudinal dataset with around 500 people and 4 time points which 
> looks like the following:
> 
> 
> id     vis      roi      reg       mean
> 101    1    Frontal    B    1.179829 | 
> 101    1      Temp    L    1.155491 | 
> 101    1   Angular    R     1.25507 | 
> 101    1      Temp    R    1.155153 | 
> 101    1       Post    B    1.351274 | 
> 101    1   Angular    L    1.221858 | 
> -------------------------------------------------| 
> 101    2    Frontal    B    1.129451 | 
> 101    2      Temp    R    1.139536 | 
> 101    2   Angular    R    1.206856 | 
> 101    2       Post    B     1.33327 | 
> 101    2      Temp    L    1.085078 | 
> 101    2   Angular    L    1.164232 | 
> .........                                      
> .......
> .....
> 
> I want to create a grand mean for each participant at each of the time points.
> 
> eg. for ID=101 and visit=1; grand_mean = (1.179829 + 1.155491 + ... + 
> 1.221858)/6
> 
>         ID=101 and visit=2; grand_mean = (1.129451 + 1.139536 + ... + 
> 1.164232)/6   and so on...
> 
> 
> Aldo, I wan to create a different grand mean just using mean values for Temp and 
> Angular i.e. for ID=101
> 
> ID=101 and visit=1; grand_mean = (1.155491 + 1.25507 + 1.155153 + 1.221858)/4 
> and so on.
> 
> Is there an easy way to accomplish this?
> 
> Thanks,
> 
> Debs
> 
> 
> 
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index