Usage

Arguments

numeric vector of p-values (possibly with NAs).
Any other R is coerced by as.numeric.

method

correction method. Can be abbreviated.

n

number of comparisons, must be at least length(p);
only set this (to non-default) when you know what you are doing!

Details

The adjustment methods include the Bonferroni correction
("bonferroni") in which the p-values are multiplied by the
number of comparisons. Less conservative corrections are also
included by Holm (1979) ("holm"), Hochberg (1988)
("hochberg"), Hommel (1988) ("hommel"), Benjamini &
Hochberg (1995) ("BH" or its alias "fdr"), and Benjamini &
Yekutieli (2001) ("BY"), respectively.
A pass-through option ("none") is also included.
The set of methods are contained in the p.adjust.methods vector
for the benefit of methods that need to have the method as an option
and pass it on to p.adjust.

The first four methods are designed to give strong control of the
family-wise error rate. There seems no reason to use the unmodified
Bonferroni correction because it is dominated by Holm's method, which
is also valid under arbitrary assumptions.

Hochberg's and Hommel's methods are valid when the hypothesis tests
are independent or when they are non-negatively associated (Sarkar,
1998; Sarkar and Chang, 1997). Hommel's method is more powerful than
Hochberg's, but the difference is usually small and the Hochberg
p-values are faster to compute.

The "BH" (aka "fdr") and "BY" method of
Benjamini, Hochberg, and Yekutieli control the false discovery rate,
the expected proportion of false discoveries amongst the rejected
hypotheses. The false discovery rate is a less stringent condition
than the family-wise error rate, so these methods are more powerful
than the others.

Note that you can set n larger than length(p) which
means the unobserved p-values are assumed to be greater than all the
observed p for "bonferroni" and "holm" methods and equal
to 1 for the other methods.

Value

A numeric vector of corrected p-values (of the same length as
p, with names copied from p).

References

Benjamini, Y., and Hochberg, Y. (1995).
Controlling the false discovery rate: a practical and powerful
approach to multiple testing.
Journal of the Royal Statistical Society Series B57,
289–300.

Benjamini, Y., and Yekutieli, D. (2001).
The control of the false discovery rate in multiple testing under
dependency.
Annals of Statistics29, 1165–1188.