How to fit two random effects separately in lme?

前端 未结 1 1493
小鲜肉
小鲜肉 2021-02-09 09:41

I\'m doing Linear mixed-effects model fit by REML in nlme package. And these are codes that work for me:

# Linear mixed-effects model fit by REML (intercept and          


        
1条回答
  •  天涯浪人
    2021-02-09 10:41

    I think it is possible to include two random effects seperately (one for speaker and one for time) using lme() by the following code:

    x4 <- lme (DV ~ IV1 + IV2 + IV1*IV2, data=a.frame, random=~ speaker + item -1 | id),
    

    with id a higher level variable in which both speaker and item are nested. If you don't have such a variable, you could introduce it as a new variable with value 1 for all observations.

    0 讨论(0)
提交回复
热议问题