From john.maindonald@anu.edu.au  Tue Jul 27 00:08:54 1999
From: john.maindonald@anu.edu.au (john.maindonald@anu.edu.au)
Date: Tue, 27 Jul 1999 01:08:54 +0200 (MET DST)
Subject: deviance.lm() should calculate a weighted SS of residuals (PR#233)
Message-ID: <199907262308.BAA12862@pubhealth.ku.dk>


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.

> roller
   weight 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


deviance.lm() should calculate a weighted SS of residuals (PR#233)
john.maindonald@anu.edu.au