Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: new to xtmixed - basic question

From   "Clyde Schechter" <>
Subject   st: Re: new to xtmixed - basic question
Date   Thu, 21 Jul 2011 07:30:37 -0700

In your first model:

The model is of the form:
 xtmixed met treatment x1 x2 x3 || participantid:, covar(unstructured)

Stata would _not_ know what the time variable is and no time effects would
be modeled.

Your second model:

. gen time2=time^2

. xtmixed met treatment x1 x2 x3 time time2|| participantid:,

gets you closer.  But here, the only thing you detect about treatment is
whether or not the trajectories of met over time are vertically displaced
from each other in the three treatment groups.  (Actually, you won't even
get that because specifying treatment the way you did, Stata will assume
you want treatment treated as a 1 df numeric variable rather than as a
3-level factor variable.)  But I would imagine you would like to consider
the possibility that the treatment leads to trajectories with different
steepness and curvature.  So I think what you really want is something

xtmixed met i.treatment##time##time2 x1 x2 x3 || participantid:,

The above will work if your time variable is simply ordinal.  If it is
actually an elapsed time you may want to treat it as continuous, in which
case you will want to substitute i.treatment##c.time##c.time2 in the

(I am assuming that you are not interested in looking at treatment effect
modification by the covariates.)

Hope this helps.

Clyde Schechter
Department of Family & Social Medicine
Albert Einstein College of Medicine
Bronx, NY, USA

Please note new e-mail address:

*   For searches and help try:

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