Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Phil Clayton <philclayton@internode.on.net> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Grand mean |
Date | Tue, 15 Mar 2011 11:15:31 +1100 |
Sorry - re-read your post - the second command should be something like: egen grand_mean_ta=mean(mean) if roi=="Temp" | roi=="Angular", by(id vis) (obviously the exact command will depend on how roi is stored) 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/