[R-sig-ME] mixed models with time as an ordered factor
Reinhold Kliegl
reinhold.kliegl at gmail.com
Mon Aug 10 18:25:16 CEST 2009
Fits will be the same for ordered(factor(dF$time)) and
factor(dF$time), but the fixed-effect estimates will differ because
they assume different default contrast specifications.
> contrasts(ordered(factor(dF$time)))
.L .Q .C ^4
1 -0.6324555 0.5345225 -3.162278e-01 0.1195229
2 -0.3162278 -0.2672612 6.324555e-01 -0.4780914
3 0.0000000 -0.5345225 -4.095972e-16 0.7171372
4 0.3162278 -0.2672612 -6.324555e-01 -0.4780914
5 0.6324555 0.5345225 3.162278e-01 0.1195229
> contrasts(factor(dF$time))
2 3 4 5
1 0 0 0 0
2 1 0 0 0
3 0 1 0 0
4 0 0 1 0
5 0 0 0 1
Of course, other contrast specfications are possible. Group
differences will be tested for each of the coefficients. Thus, by
choosing a contrast specification in line with your differential
growth expectation, you can test very specific hypotheses.
Reinhold Kliegl
On Mon, Aug 10, 2009 at 6:06 PM, Viechtbauer Wolfgang
(STAT)<Wolfgang.Viechtbauer at stat.unimaas.nl> wrote:
> Well, first of all, the m.time_ordered model essentially gives a separate parameter for each group and each time point (2 * 5 = 10 fixed effects parameters). So, this is a saturated model, where the observed means per group and time point will be equal to the fitted means. The fit of that model will be exactly the same as using time as an unordered factor:
>
> m.time_factor <- lme(measure~group*factor(time), random=~1|respondent, data=dF, method='ML')
>
> The m.time_not_ordered is different, in that is assumes a linear relationship over time (that is allowed to differ in intercept and slope for the two groups).
>
> By using time as an ordered factor, we get polynomial contrasts. So, the linear term and the linear by group interaction essentially reflect the same effects as the time and time by group interaction in the m.time_not_ordered model. However, due to the presence of the higher order terms, the results will be (slightly) different.
>
> And, not surprisingly, the AIC, BIC, and intercept variance will also be different. Especially the AIC and BIC, which are strongly affected by the number of parameters in the model, will change noticeably.
>
> Not sure if that helps.
>
> Best,
>
> --
> Wolfgang Viechtbauer
> Department of Methodology and Statistics
> School for Public Health and Primary Care
> University of Maastricht, The Netherlands
> http://www.wvbauer.com/
>
>
>
> ----Original Message----
> From: r-sig-mixed-models-bounces at r-project.org
> [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of
> dlmcarthur at post.harvard.edu Sent: Monday, August 10, 2009 04:33 To:
> r-sig-mixed-models at r-project.org Subject: [R-sig-ME] mixed models with time
> as an ordered factor
>
>> Reposting from Wed Aug 5 (since original text got scrubbed):
>>
>> For examining the shape of repeated responses over time, if time is
>> specified as an ordered factor then can at least the lower orders
>> (linear, quadratic, cubic...) and their interactions that emerge from
>> the mixed model analysis be interpreted directly?
>>
>> What to make of the differences in AIC, BIC, and random effect
>> variance, from the model that does not declare time as an ordered factor?
>>
>> How best to think about those degrees of freedom?
>>
>> Or is there some preferred alternate strategy?
>>
>> dF <- as.data.frame(cbind(rep(1:50,rep(5,50)), rep(1:2,rep(5,2)),
>> rnorm(1:250), rep(1:5,50)))
>> names(dF) <- c('respondent', 'group', 'measure', 'time')
>> m.time_not_ordered <- lme(measure~group*time, random=~1|respondent,
>> data=dF, method='ML')
>> m.time_ordered <- lme(measure~group*ordered(factor(time)),
>> random=~1|respondent, data=dF, method='ML')
>>
>> Many thanks - Dave McArthur
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list