| Title: | FDR(BH) Boxplot and FWER(Holm) Boxplot |
| Version: | 0.1.1 |
| Description: | Implements a framework for creating boxplots where the whisker lengths are determined by formal multiple testing procedures, making them adaptive to sample size and data characteristics. The function bh_boxplot() generates boxplots that control the False Discovery Rate (FDR) via the Benjamini-Hochberg procedure, and the function holm_boxplot() generates boxplots that control the Family-Wise Error Rate (FWER) via the Holm procedure. The methods are based on the framework in Gang, Lin, and Tong (2025) <doi:10.48550/arXiv.2510.20259>. |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| Depends: | R (≥ 3.5.0) |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2025-12-04 01:13:52 UTC; bowengang |
| Author: | Bowen Gang [aut, cre], Hongmei Lin [aut], Tiejun Tong [aut] |
| Maintainer: | Bowen Gang <gangbowen02@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-12-09 16:30:34 UTC |
False Discovery Rate (FDR) Boxplot
Description
Generates a boxplot where whisker lengths are determined by the Benjamini-Hochberg procedure to control the False Discovery Rate (FDR), making the outlier detection rule adaptive to sample size and data characteristics.
Usage
bh_boxplot(data, alpha = 0.01, group_col = NULL, value_col = NULL, ...)
Arguments
data |
A numeric vector for a single boxplot, or a data frame for grouped boxplots. |
alpha |
The target FDR level. Defaults to 0.01. |
group_col |
A string specifying the name of the grouping column in 'data'. |
value_col |
A string specifying the name of the value column in 'data'. |
... |
Additional arguments passed to the base |
Details
This function is a graphical implementation of the p-value pipeline proposed by Gang, Lin, and Tong (2025). It uses robust estimators for the mean and standard deviation based on quartiles to calculate p-values for each observation, then applies the Benjamini-Hochberg (BH) procedure to determine an adaptive p-value threshold for outlier detection. Outliers are points falling beyond the fences defined by this threshold.
Value
A plot is drawn on the current graphics device.
References
Gang, B., Lin, H., & Tong, T. (2025). Unifying Boxplots: A Multiple Testing Perspective.
See Also
Examples
# Single group example
set.seed(123)
data_single <- c(rnorm(50), 10, 12)
bh_boxplot(data_single, alpha = 0.05, main = "FDR Boxplot (Single Group)")
# Grouped data example
data_grouped <- data.frame(
Category = rep(c("A", "B"), each = 100),
Value = c(rnorm(100), rnorm(100, mean = 2, sd = 1.5))
)
bh_boxplot(data_grouped, group_col = "Category", value_col = "Value")
Family-Wise Error Rate (FWER) Boxplot
Description
Generates a boxplot where whisker lengths are determined by the Holm procedure to control the Family-Wise Error Rate (FWER), providing a conservative yet principled approach to outlier detection.
Usage
holm_boxplot(
data,
alpha = 0.05,
kfwer = 1,
group_col = NULL,
value_col = NULL,
...
)
Arguments
data |
A numeric vector for a single boxplot, or a data frame for grouped boxplots. |
alpha |
The target FWER level. Defaults to 0.05. |
kfwer |
The "k" in k-FWER control. Defaults to 1 for standard FWER. |
group_col |
A string specifying the name of the grouping column in 'data'. |
value_col |
A string specifying the name of the value column in 'data'. |
... |
Additional arguments passed to the base |
Details
This function is a graphical implementation of the p-value pipeline proposed by Gang, Lin, and Tong (2025). It uses robust estimators for the mean and standard deviation based on quartiles to calculate p-values for each observation, then applies the Holm procedure to determine a p-value threshold that controls the FWER. This method is generally more conservative than the FDR boxplot.
Value
A plot is drawn on the current graphics device.
References
Gang, B., Lin, H., & Tong, T. (2025). Unifying Boxplots: A Multiple Testing Perspective.
See Also
Examples
# Single group example
set.seed(123)
data_single <- c(rnorm(50), 10, 12)
holm_boxplot(data_single, alpha = 0.05, main = "FWER Boxplot (Single Group)")
# Grouped data example
data_grouped <- data.frame(
Category = rep(c("A", "B"), each = 100),
Value = c(rnorm(100), rnorm(100, mean = 2, sd = 1.5))
)
holm_boxplot(data_grouped, group_col = "Category", value_col = "Value")