pairwise comparisons between pairs of proportions in R with a correction for some multiple testing rather all possible multiple testing

Viewed 471

Is it possible to get the multiple comparison adjustment in pairwise.prop.test() to use less than the full number of comparisons? For example, if I only care about 4 vs 1,2,3 (3 comparisons) below, I would multiply the p-values in the bottom row by 3 instead of 6 (which is the full number of pairwise comparisons) to do the Bonferroni adjustment. p.adjust has the n argument, but I can't figure out how to pass it through by doing something like

pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="bonferroni", p.adjust.n = 3, alternative="two.sided", correct = FALSE)

With Bonferroni, it's trivial, but much more involved with the other types of corrections.

Here's the result (with code below):

> b <- data.frame(
+     s=c(18,53,49,30),
+   pop=c(29,100,88,73),
+   reg=c("1","2","3","4")
+ )
> pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="none",alternative="two.sided", correct = FALSE)

    Pairwise comparisons using Pairwise comparison of proportions 

data:  b$s out of b$pop 

  1     2     3    
2 0.387 -     -    
3 0.547 0.713 -    
4 0.056 0.122 0.065

P value adjustment method: none 
> pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="bonferroni", alternative="two.sided", correct = FALSE)

    Pairwise comparisons using Pairwise comparison of proportions 

data:  b$s out of b$pop 

  1    2    3   
2 1.00 -    -   
3 1.00 1.00 -   
4 0.33 0.73 0.39

P value adjustment method: bonferroni 

Code:

b <- data.frame(
    s=c(18,53,49,30),
  pop=c(29,100,88,73),
  reg=c("1","2","3","4")
)
pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="none",alternative="two.sided", correct = FALSE)
pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="bonferroni", alternative="two.sided", correct = FALSE)
1 Answers

Based on @27 ϕ 9's comment:

b <- data.frame(
    s=c(18,53,49,30),
    pop=c(29,100,88,73),
    reg=c("1","2","3","4")
)
unadj <- pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="none",alternative="two.sided")
p.adjust(unadj$p.value[3, ], method = "holm") 
pairwise.prop.test(x=b$s,n=b$pop,p.adjust.method="bonferroni", alternative="two.sided")
Related