Bookmark and Share

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, is already up and running.

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

Re: st: time in xtmixed

From   Jeph Herrin <>
Subject   Re: st: time in xtmixed
Date   Mon, 25 Mar 2013 09:39:21 -0400

I'll just add one thought to the other useful replies here. Though we still don't know what units -time- is measured in, you probably want to recenter it by substracting the smallest value. For example, if time is in years (2000, 2005, 2010), and you enter it as a continuous variable, then you are examining an effect relative to t=0, ie, the year 1BC, and so even if it is "borderline significant" it may not be very meaningful. Instead, one would want to subtract either the minimum (2000) or the mean (2005) from all time values so that the effect of the continuous variable has some reasonable interpretation. This is also true if you are using Stata elapsed dates.


On 3/25/2013 9:24 AM, Nick Cox wrote:
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 fit 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 fit, or we will promulgate

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


On Mon, Mar 25, 2013 at 1:12 PM, megan rossi <> 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 <> 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)
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:

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index