aov bug? (PR#1930)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Fri, 23 Aug 2002 06:54:41 +0100 (BST)


Maybe, but this is exactly what S does, and `weights' is not a documented
argument to aov().

I will alter print.aov to use the weighted form.

On Thu, 22 Aug 2002 iwhite@staffmail.ed.ac.uk wrote:

>
> R : Copyright 2001, The R Development Core Team
> Version 1.4.0  (2001-12-19)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type `license()' or `licence()' for distribution details.
>
> R is a collaborative project with many contributors.
> Type `contributors()' for more information.
>
> Type `demo()' for some demos, `help()' for on-line help, or
> `help.start()' for a HTML browser interface to help.
> Type `q()' to quit R.
>
> > invisible(options(echo = TRUE))
> > R.version
>          _
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    1
> minor    4.0
> year     2001
> month    12
> day      19
> language R
> > r <- c(10,23,23,26,17,5,53,55,32,46,10,8,10,8,23,0,3,22,15,32,3)
> > n <- c(39,62,81,51,39,6,74,72,51,79,13,16,30,28,45,4,12,41,30,51,7)
> > trt <- factor(rep(1:4,c(5,6,5,5)))
> > Y <- r/n
> > z <- aov(Y ~ trt,weights=n)
> > summary(z)
>             Df  Sum Sq Mean Sq F value    Pr(>F)
> trt          3 16.0626  5.3542  12.330 0.0001577 ***
> Residuals   17  7.3820  0.4342
> ---
> Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> > z
> Call:
>    aov(formula = Y ~ trt, weights = n)
>
> Terms:
>                       trt Residuals
> Sum of Squares  16.062629  0.395016
> Deg. of Freedom         3        17
>
> Residual standard error: 0.1524343
> Estimated effects may be unbalanced
> >
> > # BUG? summary(z) correctly reports the weighted residual sum of squares,
> > # but the output from z gives an unweighted residual sum of squares.
> > # At the least the discrepancy between the two forms of output is
> > # confusing.
> > proc.time()
> [1] 1.60 0.08 1.65 0.00 0.00
> >
>
> ======================================
> I.White
> ICAPB, University of Edinburgh
> Ashworth Laboratories, West Mains Road
> Edinburgh EH9 3JT
> Fax: 0131 667 3210  Tel: 0131 650 5490
> E-mail: iwhite@staffmail.ed.ac.uk
> ======================================
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley@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-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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._