Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: test after margins and xtmixed

 From Ricardo Ovaldia To statalist@hsphsun2.harvard.edu Subject Re: st: test after margins and xtmixed Date Mon, 12 Mar 2012 09:26:40 -0700 (PDT)

```Corrected post:

Dear all,

I have a question about using –margins- and –test- after –xtmixed- to test if “groups” differ at specific times. I am concerned with the small SE that margin reports.

Here is an example:

I fit the following -xtmixed- model:
. xtmixed ft i.group##month || id: group, cov(unstructured) mle

And I am interested in comparing the group effect at certain time, 3 months for example, I used –margins, post- and then –test-:

. margins, over(group month) post

Predictive margins                                Number of obs   =        344

Expression   : Linear prediction, fixed portion, predict()
over         : group month

------------------------------------------------------------------------------
|            Delta-method
|     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
group#month |
1  3  |   6.382194   .0760204    83.95   0.000     6.233196    6.531191
1  6  |   7.693377   .0819562    93.87   0.000     7.532746    7.854008
1  9  |   8.709543   .1006514    86.53   0.000      8.51227    8.906816
1 12  |   9.167792   .1323406    69.27   0.000     8.908409    9.427175
2  3  |   6.053284   .0700887    86.37   0.000     5.915913    6.190655
2  6  |   7.900573   .0777758   101.58   0.000     7.748135    8.053011
2  9  |   9.124052   .1023024    89.19   0.000     8.923543    9.324561
2 12  |   10.04959   .1374368    73.12   0.000     9.780223    10.31897
3  3  |   6.074073   .0780239    77.85   0.000     5.921149    6.226997
3  6  |   7.949809   .0856802    92.78   0.000     7.781879    8.117739
3  9  |   9.337498   .1128377    82.75   0.000      9.11634    9.558655
3 12  |   10.14703   .1480792    68.52   0.000     9.856798    10.43726
------------------------------------------------------------------------------

. test 1.group#3.month= 2.group#3.month= 3.group#3.month

( 1)  1bn.group#3bn.month - 2.group#3bn.month = 0
( 2)  1bn.group#3bn.month - 3.group#3bn.month = 0

chi2(  2) =   12.22
Prob > chi2 =    0.0022

Is this correct?

Thank you,
Ricardo

Ricardo Ovaldia, MS
Statistician
Oklahoma City, OK

--- On Mon, 3/12/12, Ricardo Ovaldia <ovaldia@yahoo.com> wrote:

> From: Ricardo Ovaldia <ovaldia@yahoo.com>
> Subject: Re: st: test after margins and xtmixed
> To: statalist@hsphsun2.harvard.edu
> Date: Monday, March 12, 2012, 10:31 AM
> Ooops, I am sorry. I meant:
>
> . test 1.group#3.month= 2.group#3.month= 3.group#3.month
>
>  ( 1)  1bn.group#3bn.month - 2.group#3bn.month = 0
>  ( 2)  1bn.group#3bn.month - 3.group#3bn.month = 0
>
>            chi2(  2)
> =   12.22
>          Prob > chi2
> =    0.0022
>
>
>
>
>
> Ricardo Ovaldia, MS
> Statistician
> Oklahoma City, OK
>
>
> --- On Mon, 3/12/12, Austin Nichols <austinnichols@gmail.com>
> wrote:
>
> > From: Austin Nichols <austinnichols@gmail.com>
> > Subject: Re: st: test after margins and xtmixed
> > To: statalist@hsphsun2.harvard.edu
> > Date: Monday, March 12, 2012, 9:50 AM
> > Ricardo Ovaldia <ovaldia@yahoo.com>:
> > You are testing whether the sixes are equal to zero,
> not
> > whether the
> > sixes are equal to each other.
> >
> > On Mon, Mar 12, 2012 at 10:46 AM, Ricardo Ovaldia
> <ovaldia@yahoo.com>
> > wrote:
> > > Dear all,
> > >
> > > I have a question about using –margins- and
> –test-
> > after –xtmixed- to test if “groups” differ at
> specific
> > times. I am concerned with the small SE that margin
> > reports.
> > >
> > > Here is an example:
> > >
> > > I fit the following -xtmixed- model:
> > > . xtmixed ft i.group##month || id: group,
> > cov(unstructured) mle
> > >
> > > And I am interested in comparing the group effect
> at
> > certain time, 3 months for example, I used –margins,
> post-
> > and then –test-:
> > >
> > > . margins, over(group month) post
> > >
> > > Predictive margins
>
> >        Number of obs   =        344
> > >
> > > Expression   : Linear prediction, fixed portion,
> > predict()
> > > over         : group month
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >             |            Delta-method
> > >             |     Margin   Std. Err.
>    z
> >    P>|z|     [95% Conf. Interval]
> > >
> >
> -------------+----------------------------------------------------------------
> > >  group#month |
> > >       1  3  |   6.382194   .0760204
>  83.95
> >   0.000     6.233196    6.531191
> > >       1  6  |   7.693377   .0819562
>  93.87
> >   0.000     7.532746    7.854008
> > >       1  9  |   8.709543   .1006514
>  86.53
> >   0.000      8.51227    8.906816
> > >       1 12  |   9.167792   .1323406
>  69.27
> > 0.000     8.908409    9.427175
> > >       2  3  |   6.053284   .0700887
>  86.37
> >   0.000     5.915913    6.190655
> > >       2  6  |   7.900573   .0777758
> 101.58
> > 0.000     7.748135    8.053011
> > >       2  9  |   9.124052   .1023024
>  89.19
> >   0.000     8.923543    9.324561
> > >       2 12  |   10.04959   .1374368
>  73.12
> > 0.000     9.780223    10.31897
> > >       3  3  |   6.074073   .0780239
>  77.85
> >   0.000     5.921149    6.226997
> > >       3  6  |   7.949809   .0856802
>  92.78
> >   0.000     7.781879    8.117739
> > >       3  9  |   9.337498   .1128377
>  82.75
> >   0.000      9.11634    9.558655
> > >       3 12  |   10.14703   .1480792
>  68.52
> > 0.000     9.856798    10.43726
> > >
> >
> ------------------------------------------------------------------------------
> > >
> > > . test 1.group#3.month 2.group#3.month
> 3.group#3.month
> > >
> > >  ( 1)  1bn.group#3bn.month = 0
> > >  ( 2)  2.group#3bn.month = 0
> > >  ( 3)  3.group#3bn.month = 0
> > >
> > >           chi2(  3) =19762.54
> > >         Prob > chi2 =    0.0000
> > >
> > > Is this correct?
> >
> > *
> > *   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/
>

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