[R] Lack-of-fit test for linear mixed effects model (lme) including two fixed effects

Bert Gunter gunter.berton at gene.com
Sun May 18 08:14:20 CEST 2014


This is really the sort of issue that should be discussed with a local
statistical expert.

(1) It is,  a statistical, not an R programming question;

(2) Would be better posed on the R-sig-mixed-moodels list anyway;

(3) As lack of fit tests tend to be basically useless and
scientifically meaningless, the real question is what is the context
for your question -- what are the meaningful practical  (not
statistical) concerns that you want to address with the test? Again,
the sort of thing best discussed in person with a local expert.

Cheers,
Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Welch




On Sat, May 17, 2014 at 10:22 AM, Isabella Zwiener <izwiener at gmx.de> wrote:
>
>    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 at 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.



More information about the R-help mailing list