[R] lm methods inconsistency?
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Mon Jan 10 18:02:11 CET 2000
On 10 Jan 2000, Tomislav Goles wrote:
>
> I'm very new to R so maybe i'm doing something wrong so
> please let me know it that is that case.
> Here is an example where the summary() and residuals()
> applied to lm object produce different results
> (I think the residuals() results is correct since SAS produces
> those numbers - the second residual corresponding to observation
> with weight 4 is wrong in summary()).
>
> x <- c( 10, 20, 30, 40 )
> y <- c( 33.8, 62.2, 92.0, 122.4 )
> w <- c( 1, 4, 1, 1 )
> lm.obj <- lm( y ~ x, weights=w )
> print( summary( lm.obj ) )
> print( residuals( lm.obj ) )
It's the documentation that is wrong. R follows S, which says for
summary.lm:
residuals: the model residuals. These are the weighted
residuals if weights were given in the model.
The function weighted.residuals gives those directly.
> PS. my version or R is 0.64.2 on Linux.
Well, we have had four versions since then, and many, many bugs have been
fixed.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list