| Title: | FDR(BH) Boxplot and FWER(Holm) Boxplot |
|---|---|
| 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>. |
| Authors: | Bowen Gang [aut, cre], Hongmei Lin [aut], Tiejun Tong [aut] |
| Maintainer: | Bowen Gang <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.1 |
| Built: | 2026-05-18 09:48:51 UTC |
| Source: | https://github.com/cran/AdaptiveBoxplot |
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.
bh_boxplot(data, alpha = 0.01, group_col = NULL, value_col = NULL, ...)bh_boxplot(data, alpha = 0.01, group_col = NULL, value_col = NULL, ...)
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 |
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.
A plot is drawn on the current graphics device.
Gang, B., Lin, H., & Tong, T. (2025). Unifying Boxplots: A Multiple Testing Perspective.
# 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")# 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")
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.
holm_boxplot( data, alpha = 0.05, kfwer = 1, group_col = NULL, value_col = NULL, ... )holm_boxplot( data, alpha = 0.05, kfwer = 1, group_col = NULL, value_col = NULL, ... )
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 |
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.
A plot is drawn on the current graphics device.
Gang, B., Lin, H., & Tong, T. (2025). Unifying Boxplots: A Multiple Testing Perspective.
# 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")# 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")