[R] Re: gregmisc version 0.7.3 now available

Warnes, Gregory R gregory_r_warnes at groton.pfizer.com
Fri Nov 1 22:17:11 CET 2002



> From: kjetil halvorsen [mailto:kjetilh at umsanet.edu.bo]
> 
> Martin Hoyle wrote:
> > 
> > Dear Greg,
> > Thanks for the new release. The decomposition of the SSQ is 
> just what I need!
> > 
> I thought decomposition of the SSQ can be obtained with the split=
> argument to summary.aov? That argument seems tro be new --- it didnt
> exist two years ago, and I was reacently made aware of it.
> It might not be well known?

You are correct that summary.aov(...,split=..) is the method to get the SSQ
decompositions for analysis of variance contrasts.  

The gregmisc package provides some functions useful for creating
(make.contrasts) and estimating (contrasts.lm) specific contrasts.  I belive
that Martin was pleased with the example I provided in the make.contrasts
help page of using aov(...,contrasts=make.contrasts(...)) and
summary.aov(...,splits=...) to get the SSQ decompositions for the contrasts
he is interested in.

FWIW, too was unaware of the split argument to aov until a week or so ago.
I imagine that many people also unfamiliar with it.  So, I'll paste my
example here just to give it more publicity, :-)

> library(gregmisc)
Loading required package: MASS 

Attaching package `gregmisc':


        The following object(s) are masked from package:base :

         lowess 

>      # Create example data set with two factors: Genotype and Time
>      set.seed(03215)
>      Genotype <- sample(c("WT","KO"), 1000, replace=TRUE)
>      Time <- factor(sample(1:3, 1000, replace=TRUE))
>      y <- rnorm(1000)
>      data <- data.frame(y, Genotype, as.factor(Time))
> 
>      cm.G <- rbind("KO vs WT"=c(-1,1) )
>      cm.T <- rbind("1 vs 2"=c(-1,1,0),
+                    "2 vs 3"=c(0,-1,1) )
> 
>      # Compute contrasts and show SSQ decompositions
> 
>       model <- aov( y ~ Genotype + Time + Genotype:Time, data=data,
+                     contrasts=list(Genotype=make.contrasts(cm.G),
+                                    Time=make.contrasts(cm.T) )
+                   )
> 
>      summary(model, split=list( Genotype=list( "KO vs WT"=1 ),
+                                 Time = list( "1 vs 2" = 1,
+                                              "2 vs 3" = 2 ) ) )

                                  Df    Sum Sq   Mean Sq F value Pr(>F)
Genotype                           1 0.0005446 0.0005446  0.0005 0.9814
  Genotype: KO vs WT               1 0.0005446 0.0005446  0.0005 0.9814
Time                               2      0.03      0.01  0.0141 0.9860
  Time: 1 vs 2                     1      0.03      0.03  0.0259 0.8722
  Time: 2 vs 3                     1 0.0023370 0.0023370  0.0023 0.9614
Genotype:Time                      2      3.20      1.60  1.6032 0.2018
  Genotype:Time: KO vs WT.1 vs 2   1      2.59      2.59  2.5900 0.1079
  Genotype:Time: KO vs WT.2 vs 3   1      0.62      0.62  0.6163 0.4326
Residuals                        994    992.39      1.00               
> 
> 
> 

-Greg


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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