# [R-sig-ME] more than 2 within-subjects factors in lme(r)

Douglas Bates bates at stat.wisc.edu
Tue Jun 17 15:02:47 CEST 2008

```On Tue, Jun 17, 2008 at 2:09 AM, Ullrich Ecker <ullrich.ecker at uwa.edu.au> wrote:
> Thank you very much, Douglas, for the reply,
>
> this
>
> Rt.lmer <- lmer(RT ~ S * R * T + (1|Subject) + (1|Subject:S:R:T), ...)
>
> is not working, however, and gives the error

> Error in lmerFactorList(formula, mf, fltype) : number of levels in
> grouping factor(s) 'S:R:T:Subj' is too large

> I do have many subjects (~100) - is that a problem?

Evaluate

length(levels(with(myData, S:R:T:Subj)[drop = TRUE])))

substituting the name of your data frame for myData.  If that is equal
to the number of observations then you cannot separately estimate a
variance for that term and the residual variance.  You will need to

>
> Also, you wrote that
>
> If you want to express Subject:Condition in terms of Subject, S, R and
> T then you just need to generate a factor with a separate level for
> each distinct combination of Subject, S, R and T, which is what
> Subject:S:R:T is.
>
> I take this to mean that
>
> Rt.lmer <- lmer(RT ~ S * R * T + (1|Subject) + (1|Subject:S:R:T), ...)
>
> is equivalent to
>
> RT.lme <- lme(RT ~ Condition, random = ~1 | Subject/Condition, Data)
>
> ...with Condition an 8-level factor - 1 level for each S R T combination.
>
> However, (and I'm REALLY sorry to bring the old "but according to
> SPSS/SAS/Statistica" argument), in my Statistica-coined experience
> the results of a post-hoc test differ if one puts in 1 8-level factor
> vs. 3 2-level factors. Am I missing something?

You are correct.  There is a difference in the interpretation of the
fixed-effects terms.  I was thinking of the structure of the
random-effects terms. when I said they were equivalent.

> Thanks again,
>
> Ulli
>
>
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

```