[R] Residuals from GLMMs in the lme4 package

From: Mairead Maclean <M.M.Maclean_at_exeter.ac.uk>
Date: Fri 09 Dec 2005 - 21:12:01 EST


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@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 Received on Fri Dec 09 21:23:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:35 EST