0

I am performing a mixed model with nlme package in R. My situation is: The mixed model is:

MY = DFC + DFC2, random=~DFC|Animal, data=my_data)

where Animal is the random effect. However, if I write the model like this, I can only obtain random intercept, and slope for DFC (by Animal), but not DFC2. I would like to have also the random slope (by Animal) for DFC2! Could you please help me?

Thank you very much,

Sven Hohenstein
  • 80,497
  • 17
  • 145
  • 168
hn.phuong
  • 835
  • 6
  • 15
  • 24

1 Answers1

0

If you use the library lme4

    library(lme4)
    fit <- lmer(y ~ x1 + x2 (1+ x1 + x2|group), data = test.df) 
    coef(fit)

Use coef() on your fitted object to see the slopes.

John Waller
  • 2,257
  • 4
  • 21
  • 26
  • this doesn't answer the OP's question -- they apparently have two continuous predictors and would like random effects on both of them. In `lme4` this would be `lmer(y~x+x2+(1+x+x2|group), ...)` (but the OP asked about `nlme`) – Ben Bolker Jan 12 '14 at 21:36
  • It works by the way of Ben Bolker. Thank you very much! – hn.phuong Jan 13 '14 at 08:42