p.adjust
Adjust P-values for Multiple Comparisons
Description
Adjusts the P-values for multiple comparisons.
Usage
p.adjust(p, method = p.adjust.methods, n = length(p))
p.adjust.methods
Arguments
p |
a numeric vector of probabilities.
|
method |
a character string. Must be one of the p.adjust.methods:
- "holm"
- "hochberg"
- "hommel"
- "bonferroni"
- "BH"
- "BY"
- "fdr"
- "none"
"holm" is the default method.
|
n |
the number of hypothesis tests performed.
Must not be less than the length of p.
|
Details
The adjust methods include the Bonferroni correction "bonferroni",
and the less conservative corrections, such as "holm", "hochberg", "hommel",
"BH" (or its alias "fdr"), and "BY". A pass-through option ("none") is also included.
For more information, see the books listed under References.
Value
returns a vector of adjusted P-values corresponding to the given method, the same length as p.
Note
The "hommel" method is not yet implemented. The "hochberg" method
is used in its place.
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. Volume 57, B. 289-300.
Benjamini, Y., and Yekutieli, D. 2001. The control of the false discovery rate in multiple testing under dependency. Annals of Statistics. Volume 29. 1165-1188.
Hochberg, Y. 1988. A sharper Bonferroni procedure for multiple tests of significance. Biometrika.
Holm, S. 1979. A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics.
Hommel, G. 1988. A stagewise rejective multiple test procedure based on a modified Bonferroni test. Biometrika.
Sarkar, S., and Chang, C. K. 1997. Simes' method for multiple hypothesis testing with positively dependent test statistics. Journal of the American Statistical Association. Volume 92. 1601-1608.
Sarkar, S. 1998. Some probability inequalities for ordered MTP2 random variables: a proof of Simes conjecture. Annals of Statistics. Volume 26. 494-504.
Shaffer, J. P. 1995. Multiple hypothesis testing. Annual Review of Psychology. Volume 46. 561-576.
Wright, S. P. 1992. Adjusted P-values for simultaneous inference. Biometrics. Volume 48. 1005-1013.
See Also
Examples
# naively search for a single-factor explanation for
# state differences in murder rates
stateData <- data.frame(check.names=FALSE, Sdatasets::state.x91)
f <- vapply(setdiff(colnames(stateData), "Murder"), function(nm) {
nm <- as.name(nm)
summary(lm(bquote(Murder ~ .(nm)), data=stateData))$fstatistic
}, FUN.VALUE=numeric(3))
rawPValue <- pf(f["value",], f["numdf",], f["dendf",], lower.tail=FALSE)
# account for looking through a list of possible explanations
rbind(rawPValue, adjustedPValue = p.adjust(rawPValue, method="BY"))