Dear all

I am trying to validate a GLMM using plots of residuals versus fitted values
and other explanatory variables. However, I am unsure what type of residuals
(or fitted values) are returned when using the residuals function on a lmer
object. My data and model are similar to the example given below  where I
have a binary response variable (y) , a continous explanatory (day) ,a two
level nominal explanatory variable (treat) and a random effect of group ( 5
groups).

set.seed(100)
y <- rbinom(n=100, size=1, prob=0.5)
day <- sample(1:10, 100, replace=T)
group <- rep(paste("group", 1:5, sep=""), times=20)
treat <- sample(c("T1", "T2"), 100, replace=T)

dataf <- data.frame(y,day,treat, group)
library(lme4)
mod.lmer <- lmer(y~day+treat+(1|group), family=binomial, data=dataf)
summary(mod.lmer)

I can extract the residuals and fitted values using the residuals and fitted
extractor functions and plot them.

res <- residuals(mod.lmer)
fit <- fitted(mod.lmer)

plot(fit,res)
abline(h=0)
plot(res~dataf$treat)
plot(res~dataf$day)

However, what do these residuals represent? Are they simply the observed
minus the fitted values, Pearsons residuals (y_i - mu_i /sqrt(mu_i)),
deviance residuals etc? Also, I would like to extract both the residuals
conditional on the random effect and also the residuals based on both the
fixed and random effects but am unsure how to do this. Any
advice/clarification would be gratefully appreciated.


Thank you
Martin

> sessionInfo()
R version 2.10.1 (2009-12-14)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_0.999375-32   Matrix_0.999375-38 lattice_0.18-3

loaded via a namespace (and not attached):
[1] grid_2.10.1  tools_2.10.1
>

	[[alternative HTML version deleted]]


