[Rd] Wrong sign for Pearson residuals (PR#862)

faraway@umich.edu faraway@umich.edu
Mon, 5 Mar 2001 18:04:35 +0100 (MET)


Full_Name: Julian Faraway
Version: 1.2.1
OS: Linux + NT
Submission from: (NULL) (141.211.66.172)


Consider the following data from McCullagh and Nelder:

> clot
   time conc lot
1   118    5 one
2    58   10 one
3    42   15 one
4    35   20 one
5    27   30 one
6    25   40 one
7    21   60 one
8    19   80 one
9    18  100 one
10   69    5 two
11   35   10 two
12   26   15 two
13   21   20 two
14   18   30 two
15   16   40 two
16   13   60 two
17   12   80 two
18   12  100 two
> g <- glm(time ~ log(conc)*lot, Gamma, clot)
> residuals(g)
         1          2          3          4          5          6          7 
-0.0400835  0.0864112  0.0490090  0.0290499 -0.0384659  0.0011126 -0.0286959 
         8          9         10         11         12         13         14 
-0.0375571 -0.0263724 -0.0292475  0.0637151  0.0394632 -0.0175449  0.0143592 
        15         16         17         18 
 0.0103035 -0.0557378 -0.0466764  0.0171410 
> residuals(g,type="pearson")
         1          2          3          4          5          6          7 
 0.0395493 -0.0889174 -0.0498126 -0.0293318  0.0379742 -0.0011130  0.0284220 
         8          9         10         11         12         13         14 
 0.0370884  0.0261410  0.0289630 -0.0650753 -0.0399839  0.0174424 -0.0144280 
        15         16         17         18 
-0.0103389  0.0547070  0.0459530 -0.0172391 

The Pearson residuals have the wrong sign. It seems the sign is taken from the 
working residuals. The sign is reversed because the inverse link function
used in this example. The problem could be easily fixed by taking the sign from

the response residuals.

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