john.maindonald@anu.edu.au
1999-Jul-26 23:08 UTC
deviance.lm() should calculate a weighted SS of residuals (PR#233)
Here is a (slightly silly) example. Surely deviance.lm() should calculate a weighted sum of squares about the mean, not a sum of squares. deviance.glm() is correct.> rollerweight depression 1 1.9 2 2 3.1 1 3 3.3 5 4 4.8 5 5 5.3 20 6 6.1 20 7 6.4 23 8 7.6 10 9 9.8 30 10 12.4 25> roller.lm<-lm(weight~depression,data=roller,weights=1:10) > roller.glm<-glm(weight~depression,data=roller,weights=1:10)> deviance(roller.lm)[1] 35.493> deviance(roller.glm)[1] 240.67> # Now change the definition of deviance.lm > deviance.lm<-function(object, ...)sum(weighted.residuals(object)^2) > deviance(roller.lm)[1] 240.67>--please do not edit the information below-- Version: platform = Windows arch = x86 os = Win32 system = x86, Win32 status = status.rev = 0 major = 0 minor = 64.2 year = 1999 month = July day = 3 language = R Windows 9x 4.0 (build 1111) B Search Path: .GlobalEnv, Autoloads, package:base John Maindonald email : john.maindonald@anu.edu.au Statistical Consulting Unit, phone : (6249)3998 c/o CMA, SMS, fax : (6249)5549 John Dedman Mathematical Sciences Building Australian National University Canberra ACT 0200 Australia -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._