Compute step-down critical alpha values using Holm's method
Source:R/p_to_holmalpha.r
p_to_holmalpha.RdGiven a vector of p-values, this function computes the per-hypothesis
critical alpha thresholds following Holm's step-down procedure
(1979). Unlike p.adjust, which returns adjusted
p-values, this function returns the maximum allowable alpha for each
test under Holm's method.
Arguments
- p
A numeric vector of p-values. Must be within \([0, 1]\).
- sig.level
Overall significance level (family-wise error rate), a single numeric value between 0 and 1. Default is 0.05.
- na.rm
Logical. If
TRUE, missing values inpare removed with a warning (unlesswarn = FALSE); ifFALSE, the function stops when missing values are detected. Default isFALSE.- warn
Logical. If
TRUE(default), warnings are issued for duplicated p-values or removed NAs. IfFALSE, warnings are suppressed.
Value
A numeric vector of the same length as p, containing the
per-hypothesis critical alpha thresholds.
Details
Holm's method sorts p-values in ascending order, compares them to
sequentially adjusted thresholds \(\alpha / (K - i + 1)\), and fixes
the subsequent thresholds once the first non-significant result is
encountered. This function implements that procedure and restores the
results to the original order of p.
References
Holm, S. (1979). A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics, 6(2), 65–70.
See also
p.adjust for adjusted p-values.
Examples
p <- c(0.01, 0.04, 0.03, 0.20)
p_to_holmalpha(p)
#> [1] 0.01250000 0.01666667 0.01666667 0.01666667