Solved – Uncorrected pairwise p-values for one-way ANOVA

I'm performing a relatively simple one-way ANOVA as part of a class exercise. I'd like to get pairwise uncorrected p-values out of R, so I can do a sequential FDR test in another package (I realize there are FDR packages in R as well). I've set up my ANOVA as shown below, and it works fine, produces results, but I can't seem to figure out how to get the raw, uncorrected p-values back. Ultimately, I'd like to do the pairwise tests for both FDR and sequential Bonferroni in R, but this seems like a first step.

It looks like pairwiseCI or multcomp might get me where I'm trying to go, but I'm having a difficult time figuring out which will do what I'm looking for.

R> head(d10)   time  breed 1 27.4 type.A 2 18.3 type.A 3 24.3 type.B 4 19.6 type.B 5 21.6 type.C 6 30.3 type.D  a10 <- aov(time~breed,data=d10)  # reports the overall significance, but nothing on the pairs   summary(a10)  # reports corrected values only TukeyHSD(a10) 

For the multcomp package, see the help page for glht; you want to use the "Tukey" option; this does not actually use the Tukey correction, it just sets up all pairwise comparisons. In the example section there's an example that does exactly what you want.

This calculates the estimates and se's for each comparison but doesn't do p-values; for that you need summary.glht; on the help page for that, notice in particular the test parameter, that allows you to set the actual test that is run. For doing multiply-adjusted p-values, you use the adjusted function for this parameter, and to not multiply-adjust, you use test=adjusted("none") (which isn't mention specifically in the help page, though it does say it takes any of the methods in p.adjust, which is where you'd find none.)

You can also compute the estimates and se's by hand using matrix multiplication, and then get the p-values however you want; this is what the glht function is doing behind the scenes. To get the matrices you need to start you'd use coef and vcov.

I didn't put complete code as you say it's for a class project (thanks for being honest, by the way!) and the policy here is to provide helpful hints but not solutions.

Similar Posts:

Rate this post

Leave a Comment