From ripley at stats.ox.ac.uk  Fri Jul 15 12:24:44 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 15 Jul 2005 11:24:44 +0100 (BST)
Subject: [Rd] Adjusted p-values with TukeyHSD (patch)
In-Reply-To: <20050715064943.GA5748@ime.usp.br>
References: <20050715064943.GA5748@ime.usp.br>
Message-ID: <Pine.LNX.4.61.0507151117350.7335@gannet.stats>

We will incorporate a version of this in R-devel and hence 2.2.0.

A bit more work needs to be done on printing: whereas the existing three 
columns are in comparable units, the p values are not and so get printed 
to silly accuracies (as can be seen in your example).

You also need to explain what "p adj" is.

On Fri, 15 Jul 2005, Fernando Henrique Ferraz P. da Rosa wrote:

>        Dear R-developeRs,
>
>        Attached follows a patch against svn 34959 that adds the
> printing of p-values to the TukeyHSD.aov function in stats package. I
> also updated the corresponding documentation file and added a 'see also'
> reference to the simint function of the multcomp package.
>
>        As it was already brought up in a previous thread [1] in R-help,
> one can obtain the adjusted p-values using the multcomp package and its
> simint function. The problem is that currently the simint function
> scales very badly for a large number of contrasts (> 15). While the output
> of TukeyHSD is almost instantaneous, simint may take more than half an
> hour to process 19 contrasts.
>
>        As a toy example, try:
>
>        y <- rnorm(500)
>        A <- gl(5,100)
>        system.time(h1 <- TukeyHSD((aov(y ~ A))))
>        system.time(h2 <- simint(y ~ A,type="Tukey"))
>
>        Here I got:
>        [1] 0.09 0.01 0.10 0.00 0.00
>        [1] 26.87  0.03 27.10  0.00  0.00
>
>        For a small number of contrasts they're equivalent, for example:
>
>        data(warpbreaks)
>        fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
>        tHSD <- TukeyHSD(fm1, "tension", ordered = FALSE)
>        print(tHSD)
>        mcHSD <- simint(breaks ~ wool + tension, data = warpbreaks,
>                     whichf="tension", type="Tukey")
>        summary(mcHSD)
>
>        I also attached the complete function (mTukeyHSD.R) to this
> message, in case the patch is not accepted and someone else needs to do
> the same thing. In any case, I think the reference to the multcomp
> package in the TukeyHSD help page should be considered even if the patch
> to the function is not accepted.
>
>       Thank you,
>
> References
> [1] http://tolstoy.newcastle.edu.au/R/help/05/05/4599.html
>
> --
> Fernando Henrique Ferraz P. da Rosa
> http://www.ime.usp.br/~feferraz
>

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Adjusted p-values with TukeyHSD (patch)
Prof Brian Ripley