Title: Benjamini-Hochberg Alpha Correction
Version: 0.0.2
Description: Provides the alpha-adjustment correction from "Benjamini, Y., & Hochberg, Y. (1995) <doi:10.1111/j.2517-6161.1995.tb02031.x> Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal statistical society: series B (Methodological), 57(1), 289-300". For researchers interested in using the exact mathematical formulas and procedures as used in the original paper.
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: knitr
Suggests: rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
License: MIT + file LICENSE
NeedsCompilation: no
Packaged: 2025-03-10 18:26:04 UTC; michael
Author: Michael Mogessie ORCID iD [aut, cre]
Maintainer: Michael Mogessie <mogessie@upenn.edu>
Repository: CRAN
Date/Publication: 2025-03-10 19:30:02 UTC

Calculate Benjamini-Hochberg alphas for a list of p-values.

Description

This function calculates alphas for a list of p-values and for a given false discovery rate (Q). If Q is not provided, a default value of 0.05 is used. The Benjamini-Hochberg alpha correction is calculated as: alpha=(i/m)Q, where: i = the individual p-value's rank in the list of p-values, m = the total number of tests, and Q = the false discovery rate.

Usage

get_alphas_bh(
  p_values,
  Q = 0.05,
  output = "both",
  include_is_significant_column = TRUE
)

Arguments

p_values

A list of p-values.

Q

the false discovery rate. If not provided, a default value of 0.05 is used.

output

An option to control the function's output. Valid values are:

  • print - print the data frame to the console only.

  • data_frame - return the data_frame only.

  • both - print the data frame to the console and return it. The default is 'both' so if you do not provide this option the data frame will be printed to the console and returned.

include_is_significant_column

This Boolean option will control if the is significant? column is included in the printed or returned data frame. If TRUE, it will be included. If FALSE, it will be omitted. The default is TRUE so if you do not provide this option the is significant? column will be included.

Value

A list of alpha values or an error message if the provided p-values are not valid.