[Rd] Possible bug in summary of residuals with lm and weights

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
Date: Sun 26 Jun 2005 - 21:49:31 GMT


I'm not sure if this is intentional. summary.lm stores weighted residuals whereas I think most users will want print.summary.lm to summarize unweighted ones as if saying summary(resid(fit)).

> set.seed(1)
> dat <- data.frame(y = rnorm(15), x = rnorm(15), w = 1:15)
> f <- lm(y ~ x, weights = w, data = dat)
> summary(f)
. . . .
Residuals:

    Min 1Q Median 3Q Max
-8.260 -1.565 0.117 2.105 4.666
. . . .
> resid(f)

           1 2 3 4 5 6 -0.73429677 0.06818092 -1.20558034 1.25783256 0.05231879 -1.18383039

           7 8 9 10 11 12   0.16034166 0.59880438 0.98337588 -0.58944957 1.40690588 0.31138819

          13 14 15
-0.35111933 -2.20770335 0.89438636

> version

platform i386-pc-linux-gnu

arch     i386
os       linux-gnu

system i386, linux-gnu
status
major 2
minor 1.0
year 2005
month 04
day 18
language R
-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon Jun 27 07:55:05 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:22 GMT