[R] Residuals from GLMMs in the lme4 package
Renaud Lancelot
renaud.lancelot at gmail.com
Fri Dec 9 13:29:44 CET 2005
I guess you are using obsolete versions of lme4 / Matrix. Please
update and try again. The current versions are:
> help(package = "Matrix")
Information on package 'Matrix'
Description:
Package: Matrix
Version: 0.99-2
Date: 2005-11-14
[snip]
> help(package = "lme4")
Information on package 'lme4'
Description:
Package: lme4
Version: 0.98-1
Date: 2005-07-27
[snip]
Best,
Renaud
2005/12/9, Mairead Maclean <M.M.Maclean at exeter.ac.uk>:
> Hello there
>
> This is the first time I have used r-help message board so I hope I have got
> the right address.
>
> I am trying to check the residuals of a GLMM model(run using the package
> lme4). I have been able to check the residiuals of REMLs in lme4 using the
> following:
>
> m1<-lmer(vTotal~Week+fCollar+ (1|fCat), collars)
>
> res<-resid(m1)
> plot(res)
> qqnorm(res)
> library(MASS)
> par(mfrow=c(2,3))
> res<-residuals(m1)
> truehist(res,main="Histogram of Residuals")
> curve(dnorm(x,mean=mean(res),sd=sd(res)),add=TRUE)
> qqnorm(fitted(m1),resid(m1), ylim=range(fitted(m1)), main="QQNorm Plot")
> plot(residuals(m1)~fitted(m1),main="Resid
> vs.Fits",xlab="Fits",ylab="Resids");abline(h=0)
> plot(residuals(m1),type="l",main="Resid vs Order",ylab="Resids")
> acf(residuals(m1), main="Resid Autocorrelation")
> boxplot(vTotal~fCollar, data=collars,main="Box plot of Collars", ylab="No.of
> Prey", xlab="Collar")
>
> but with this model:
>
> m1<-lmer(vTotal~Week+fCollar+ (1|fCat), collars, poisson(), method = "PQL")
>
> I can not get the above code line for residuals to work. The stumbling
> block is the residual command. When I run it I get the following:
> > res<-resid(m1)
> > res
> numeric(0)
>
> Can not find any other way to get the residuals and I even tried getting the
> fitted values from the model but get a similar output:
>
> > catfit<-fitted(m1)
> > catfit
> numeric(0)
>
> Do you think there may be something wrong with the model itself or is it
> just that there is an alternative way to checking residuals in GLMMs? I
> would be very grateful for any help!
>
> Many thanks
>
> Mairead Maclean
> Centre for Ecology and Conservation Biology
> Exeter University
> Tremough Campus
> CORNWALL
> UK
> TR10 9EZ
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
Renaud LANCELOT
Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD
Directeur adjoint chargé des affaires scientifiques
CIRAD, Animal Production and Veterinary Medicine Department
Deputy director for scientific affairs
Campus international de Baillarguet
TA 30 / B (Bât. B, Bur. 214)
34398 Montpellier Cedex 5 - France
Tél +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 39 04
Fax +33 (0)4 67 59 37 95
More information about the R-help
mailing list