Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: time in xtmixed

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: time in xtmixed Date Mon, 25 Mar 2013 13:24:53 +0000

```You could e.g. try a model without time, calculate residuals and then
look at the distributions of residuals separated by time values.

Which do you expect to a better model of the process? Do you expect,
scientifically (medically, biologically, whatever), linear effects in
time? What do you expect scientifically?

Thought for the day from Leland Wilkinson.The last sentence can bite:

"It is not always convenient to remember that the right model for a
population can ﬁt a sample of data worse than a wrong model—even a
wrong model with fewer parameters. We cannot rely on statistical
diagnostics to save us, especially with small samples. We must think
about what our models mean, regardless of ﬁt, or we will promulgate
nonsense."

Leland Wilkinson. 2005. The Grammar of Graphics. New York: Springer,
2005, p.354.

Nick

On Mon, Mar 25, 2013 at 1:12 PM, megan rossi <megan_rossi@msn.com> wrote:
>
>
> How is this for confusing, when time is as a continuous variable (ie. option a)the association between depvar and indepvar is significant (time is borderline sig p=0.055), however as a categorical variable, option b, the relationship between depvar and indepvar becomes insignificant...and time 1 and 2 become very insignificant (p=0.55 and 0.17)
> In both scenarios the overall significance of the model is <0.0001 and log likelihoods are the same. The interaction between indepvar and time is only significant at time 0 not 1 or 2.
> If I did go with option a, could I really say that independent of time depvar and indepvar are association?

David Hoaglin

>> To expand on Maarten's reply, i.time will give you separate effects
>> for the second and third time points (and the effect at the first time
>> point will be part of the constant term). If you use time as a
>> "continuous" predictor, its coefficient will be the slope of depvar
>> against time (adjusted for the contribution of indepvar), and the
>> constant term will correspond to time = 0. The second model is
>> simpler, but it assumes that the contribution of time is linear.

On Mon, Mar 25, 2013 at 3:06 AM, megan rossi <megan_rossi@msn.com> wrote:

>> > Can anyone advise me on whether I need to include time variable as a categorical variable (ie. have a prefix i.) in xtmixed or can it be treated as a continous variable even though the data was collected at only three time points (evenly spaced). My research question: is depvar associated with indepvar independent of time ie. is syntax a or b most appropriate:
>> > a) xtmixed depvar indepvar time||ptid:time,cov(uns)
>> > or
>> > b) xtmixed depvar indepvar i.time||ptid:time,cov(uns)
>> > I noticed that the stata youtube video on this doesn't include i. however it was from 9 time points, not 3.

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