[R-sig-ME] plotting residuals vs. fitted values by group
Rachel Cohen
s0957429 at sms.ed.ac.uk
Tue Jan 18 19:16:32 CET 2011
Hi, I am quite new to using R and am currently trying to plot the
residuals vs. fitted values by group, taken from an lmer model within
lme4_0.999375-36. The model i'm using is:
mod5<-lmer((centre.log.mass)~centre.log.dbh+centre.log.height+(1+centre.log.height|species_site),REML=F)
I have tried:
plot(mod5, resid(.)~fitted(.)|species_site)
but get the following error message:
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
I'm not sure what this means? I have managed to plot the overall model
residuals vs. fitted values by using:
fit<-fitted(mod5)
res<-resid(mod5)
plot(fit,res, main="Model V Residuals vs. Fitted Mass", ylab="Ln
Residual", xlab="Ln Fitted Mass")
However, I'm not sure how to get an individual group-level plot for each
of my 12 groups of residuals vs. fitted.
Any help would be greatly appreciated!
Rachel Cohen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the R-sig-mixed-models
mailing list