Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Joerg Luedicke <joerg.luedicke@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: question: an example of xtmixed: testing differences between groups at specific times |
Date | Thu, 10 Jan 2013 14:27:33 -0500 |
Vince Wiggins of StataCorp told me off-list that "-margins- can perform the linear combination and tests for you directly. Just insert a contrast operator on the factor variable girl." He provides an example with the auto dataset (-sysuse auto-): . regress mpg c.length##i.foreign . margins r.foreign, at(length=(150 170 190 210)) I am still using Stata 11 and therefore am not familiar with the new -margins- features of Stata 12. I should have pointed that out in my post. Joerg On Wed, Jan 9, 2013 at 9:41 PM, Sun, Wensheng <wsun@bcm.edu> wrote: > Hi, Joerg, > > I got it. Thanks. > > Carol > > ________________________________________ > From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joerg Luedicke [joerg.luedicke@gmail.com] > Sent: Wednesday, January 09, 2013 8:20 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: question: an example of xtmixed: testing differences between groups at specific times > > If by "compare" you mean hypothesis testing, try > > margins girl, at(age=(0.5 1 1.5 2)) coefl post > > Then, for example, testing the difference between boys and girls at > baseline would be: > > test _b[1bn._at#0bn.girl] = _b[1bn._at#1.girl] > > To test the difference between age 0.5 and age 1 for boys would be: > > test _b[1bn._at#0bn.girl] = _b[2._at#0bn.girl] > > If you were interested in estimating the difference including a > confidence interval between age 0.5 and age 1 for boys, you could > type: > > lincom _b[2._at#0bn.girl] - _b[1bn._at#0bn.girl] > > > Joerg > > > On Tue, Jan 8, 2013 at 8:49 PM, Sun, Wensheng <wsun@bcm.edu> wrote: >> Hi, >> >> I am using –xtmixed- on a longitudinal study with planned measurements at 0, 6, 12 and 24 months, but very few follow-up measurements at the planned time. I have fitted the model and need to evaluate changes from baseline and also differences between two treatment groups at exactly 6, 12 and 24 months. The –xtmixed- followed by –margins- gives margins and standard error at each time. How do I compare them? I am using Stata 12 for Windows. >> >> An example of that in public shared data should be >> >> . webuse childweight >> . xtmixed weight c.age##i.girl || id: age, cov(uns) res(ind) mle variance >> . margin girl, at(age=(0.5 1 1.5 2)) >> >> What STATA commands should I use if I want to compare the weight between boys and girls at age of 0.5, 1, 1.5, and 2? and How should I compare changes from .5-year to 1 or 1.5 or 2 in girls and boys? >> >> Thank you very much! >> >> >> Carol >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/