### Stata Code Fragment Šidák-Holm Adjusted p-values

Consider the 15 p-values shown below derived from a series of hypothesis tests. Following the p-values are the commands for computing the Šidák-Holm adjusted p-values. Also shown are the Bonferroni adjusted p-values for comparison. The Šidák-Holm adjusted values are slightly less conservative than the Bonferroni adjusted values.
      pvalue
1.  .2703633
2.  .2861805
3.  .0674455
4.  .2884618
5.  .0522945
6.  .0094186
7.  .0412532
8.  .1566575
9.    .00296
10.  .0068728
11.   .025553
12.  .3102804
13.  .0042578
14.  .0031542
15.   .000024

sort pvalue
gen k=(_N+1)-_n
clist

pvalue          k
1.   .000024         15
2.    .00296         14
3.  .0031542         13
4.  .0042578         12
5.  .0068728         11
6.  .0094186         10
7.   .025553          9
8.  .0412532          8
9.  .0522945          7
10.  .0674455          6
11.  .1566575          5
12.  .2703633          4
13.  .2861805          3
14.  .2884618          2
15.  .3102804          1

generate sidak=1-(1-pvalue)^k
replace  sidak=sidak[_n-1] if sidak[_n-1]>sidak in 2/L

clist  /* .05 significant p-values manually annotated */

pvalue    k      sidak

1.   .000024   15   .0003597  /* <- sig at .05 */
2.    .00296   14   .0406521  /* <- sig at .05 */
3.  .0031542   13   .0406521  /* <- sig at .05 */
4.  .0042578   12   .0499139  /* <- sig at .05 */
5.  .0068728   11   .0730554
6.  .0094186   10   .0902925
7.   .025553    9   .2078198
8.  .0412532    8   .2861095
9.  .0522945    7    .313384
10.  .0674455   6   .3422735
11.  .1566575   5    .573401
12.  .2703633   4   .7165824
13.  .2861805   3   .7165824
14.  .2884618   2   .7165824
15.  .3102804   1   .7165824

/* Bonferroni adjusted values for comparison */
generate bonferroni=pvalue*15
clist  /* .05 significant p-values manually annotated */

pvalue        k      sidak  bonferroni
1.   .000024       15   .0003597   .0003598  /* <- sig at .05 */
2.    .00296       14   .0406521      .0444  /* <- sig at .05 */
3.  .0031542       13   .0406521   .0473124  /* <- sig at .05 */
4.  .0042578       12   .0499139    .063867
5.  .0068728       11   .0730554   .1030915
6.  .0094186       10   .0902925   .1412788
7.   .025553        9   .2078198    .383295
8.  .0412532        8   .2861095   .6187974
9.  .0522945        7    .313384    .784417
10.  .0674455        6   .3422735   1.011683
11.  .1566575        5    .573401   2.349863
12.  .2703633        4   .7165824   4.055449
13.  .2861805        3   .7165824   4.292707
14.  .2884618        2   .7165824   4.326927
15.  .3102804        1   .7165824   4.654205

If we put all of the pieces of code together, we get the following.

sort pvalue
gen k=(_N+1)-_n
generate sidak=1-(1-pvalue)^k
replace  sidak=sidak[_n-1] if sidak[_n-1]>sidak in 2/L
generate bonferroni=pvalue*15

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.