Dear list members,

   I fitted a linear mixed effects model using the lme function from nlme
   package. In the model I included two fixed effects, one being continuous and
   one a factor having 4 categories. Furthermore, I have one random effect (id)
   which I want to include as a random intercept only. I used the following
   code:

   fit1 <- lme(outcome ~ fixed1 + fixed2, random = ~1|id)

   Now I would like to perform a lack-of-fit test. In a previous post (where
   there  was only one continuous fixed effect) I have seen the following
   suggestion:

   fit1 <- lme(outcome ~ fixed1, random = ~1|id, method="ML")
   fit2  <-  lme(outcome  ~ factor(fixed1, ordered=TRUE), random = ~1|id,
   method="ML")
   anova(fit1,fit2)

   Now my questions are:
   1) How do I perform a lack-of-fit test with one continuous and one factor as
   fixed affects?
   2) Is it necessary to set method=ML for the lack-of-fit test?
   3)  If  I have to use method=ML for the lack-of-fit test, should I use
   method=ML also in my model taht I would like to interpret? In my original
   model I used REML, but only because this is the default in lme and I did not
   change it.

   As I have not applied a lack-of-fit test before, I would really be glad for
   any help!

   Best regards,
   John
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to