# Finding the effect of time from a multilevel model?

I would like to determine the effect of AGE or equivalently "time" on a continuous outcome variable while controlling for gender. I have repeated measures data across 6 time points. In order to take into account the correlation of the repeated measures, I am thinking of using a random slops/random intercepts model multilevel model where "measurements at different ages" are clustered within individuals. I am a bit confused about interpretation of model coefficients. What coefficients should I look at to the extract the effect of a one unit increase in time/age on my outcome?

N26

-

The coefficient that tells you the effect of a one unit increase in time/age on the outcome is the coefficient on the age variable, where age is entered as a level one predictor. But you don't get just one such coefficient. You get one per subject, plus a coefficient representing the mean of all those coefficients.

Let's say you fit a linear growth random-coefficients model, no predictors at level two. The level one model includes age as a predictor:

$$Y_{ti} = \pi_{0i} + \pi_{1i} \cdot Age_{ti} +e_{ti}$$ where $$e_{ti} \sim N(0,\sigma^2)$$

Individuals are indexed by $i$, time by $t$, so $Y_{ti}$ gives the outcome at time $t$ when individual $i$ has age $Age_{ti}$. Then level two models the $\pi_{pi}$ (level one intercepts and slopes) as random:

$$\pi_{0i} = \beta_{00} + r_{0i}$$ $$\pi_{1i} = \beta_{10} + r_{1i}$$ Again with errors distributed normally. $\pi_{1i}$ is the coefficient of interest. It tells you the expected change during one unit of time. One such coefficient is estimated per subject; $\beta_{10}$ gives the mean of those slopes.

If you use R's nlme package to fit a linear growth model like this, you could use ranef() to get the values of $\pi_{1i}$:

> fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)
> ranef(fm1)

(Intercept)          age
M16  -0.1877570 -0.068853740
M05  -1.1766673  0.025600299
M02  -0.7275013  0.014507808
M11   0.8904899 -0.118825903
...


You get an estimated slope on age for each individual subject. You can also get the fixed effects (values of $\beta_{00}$ and $\beta_{10}$) from the fit object:

> fixef(fm1)
(Intercept)         age
16.7611111   0.6601852


The fixed effect here under age is the mean of the $\pi_{1i}$ coefficients.

Reference

Raudenbush, S. W., & Bryk, A. S. (2002). Hierarchical linear models: Applications and data analysis methods. Thousand Oaks: Sage Publications.

-
+1, though I would recommend R's lme4 package, where I believe your model would be fm2 <- lmer (distance ~ age + (age | Subject), Orthodont) and you could get the coefficients with the same ranef and fixef calls. Also, package arm provides the fixef.se and ranef.se functions that I find useful. –  Wayne Jan 29 '12 at 15:45
Thanks @Wayne, I haven't fit mlms for a while in R and couldn't remember what I used. Now I remember I used lme4 via arm--I agree, that's a good way to go. –  Anne Z. Jan 29 '12 at 16:47

If you are using R, have a look at the nlme package and the Orthodont data that comes with the package. This book is mentioned as a Source under the description of that dataset,

Pinheiro, J. C. and Bates, D. M. (2000), Mixed-Effects Models in S and S-PLUS, Springer, New York. (Appendix A.17)

which I have used heavily in coming to grips with mixed effect modelling.

It depends on what type of model you're trying to fit, however, using lme in the nlme package for R, you could fit a model like this:

lme(Outcome ~ Gender*Age, Data=YourData, random= ~1|SubjectID)


where you should get the main effects for Gender and Age as well as the interaction of the two.

The example in the book centres the data, as the dental measurements were only taken between ages 8 and 14, so age was centred at 11. You may need to centre your age as well.

-
proc mixed data = mydata;