willow1980
2009-Nov-21 13:14 UTC
[R] deviance from lmer model: deviance(model) and sum(resid(model)^2), which one is correct?
Dear R users, I am frustrated by the residual sum of squares calculation. From Statistical Medhods by Snedecor & Cochran, I know sum(resid(model)^2) should be one method. However, there is a automatic code in R for this operation: deviance(model). When I compare the results from these two methods, I find they are different. For example, in my case, sum(resid(modelkidformalp)^2)=279.2061, but deviance(modelkidformalp)=308.7216 (by ML algorithm). Then, what is the reason for such a difference? Thank you very much for your attention! Best regards, Jianghua -- View this message in context: http://old.nabble.com/deviance-from-lmer-model%3A-deviance%28model%29-and-sum%28resid%28model%29%5E2%29%2C-which-one-is-correct--tp26456452p26456452.html Sent from the R help mailing list archive at Nabble.com.