| Title: | Online Error Rate Control |
|---|---|
| Description: | Allows users to control the false discovery rate (FDR) or familywise error rate (FWER) for online multiple hypothesis testing, where hypotheses arrive in a stream. In this framework, a null hypothesis is rejected based on the evidence against it and on the previous rejection decisions. |
| Authors: | David S. Robertson [aut, cre], Lathan Liou [aut], Aaditya Ramdas [aut], Adel Javanmard [ctb], Andrea Montanari [ctb], Jinjin Tian [ctb], Tijana Zrnic [ctb], Natasha A. Karp [aut], Nikita Mozgunov [ctb] |
| Maintainer: | David S. Robertson <[email protected]> |
| License: | GPL-3 |
| Version: | 2.21.2 |
| Built: | 2026-10-13 03:50:04 UTC |
| Source: | https://github.com/bioc/onlineFDR |
Implements the ADDIS algorithm for online FDR control, where ADDIS stands for an ADaptive algorithm that DIScards conservative nulls, as presented by Tian and Ramdas (2019). The algorithm compensates for the power loss of SAFFRON with conservative nulls, by including both adaptivity in the fraction of null hypotheses (like SAFFRON) and the conservativeness of nulls (unlike SAFFRON).
ADDIS( d, alpha = 0.05, gammai, w0, lambda = 0.25, tau = 0.5, async = FALSE, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )ADDIS( d, alpha = 0.05, gammai, w0, lambda = 0.25, tau = 0.5, async = FALSE, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). For the asynchronous version, the date column is replaced by decision times (‘decision.times’). |
alpha |
Overall significance level of the procedure, the default is 0.05. |
gammai |
Optional vector of |
w0 |
Initial ‘wealth’ of the procedure, defaults to |
lambda |
Optional parameter that sets the threshold for ‘candidate’ hypotheses. Must be between 0 and tau, defaults to 0.25. |
tau |
Optional threshold for hypotheses to be selected for testing. Must be between 0 and 1, defaults to 0.5. |
async |
Logical. If |
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values, or a dataframe with three columns. The dataframe requires an identifier (‘id’), date (‘date’) and p-value (‘pval’). If the asynchronous version is specified (see below), then the column date should be replaced by the decision times.
Given an overall significance level , ADDIS depends on constants
, and . Here represents the
initial ‘wealth’ of the procedure and satisfies .
represents the threshold for a
hypothesis to be selected for testing: p-values greater than are
implicitly ‘discarded’ by the procedure. Finally,
sets the threshold for a p-value to be a candidate for rejection: ADDIS will
never reject a p-value larger than . The algorithm also
requires a sequence of non-negative non-increasing numbers that
sum to 1.
The ADDIS procedure provably controls the FDR for independent p-values. Tian
and Ramdas (2019) also presented a version for an asynchronous testing
process, consisting of tests that start and finish at (potentially) random
times. The discretised finish times of the tests correspond to the decision
times. These decision times are given as the input decision.times.
Note that this asynchronous version controls the modified FDR (mFDR) and,
under the conditions given in Tian and Ramdas (2019), Appendix C, also the
FDR.
Further details of the ADDIS algorithms can be found in Tian and Ramdas (2019).
out |
A dataframe with the p-values |
Tian, J. and Ramdas, A. (2019). ADDIS: an adaptive discarding algorithm for online FDR control with conservative nulls. Advances in Neural Information Processing Systems 32, 9388-9396.
SAFFRON is the special case of ADDIS with tau = 1.
SAFFRONstar provides asynchronous versions of SAFFRON.
sample.df1 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) ADDIS(sample.df1, random=FALSE) sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) ADDIS(sample.df2, async = TRUE) # Asynchronoussample.df1 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) ADDIS(sample.df1, random=FALSE) sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) ADDIS(sample.df2, async = TRUE) # Asynchronous
Implements an exhaustive variant of the ADDIS-spending algorithm for online FWER control, as presented by Fischer et al. (2024). The procedure is a uniform improvement of ADDIS-spending, and, under the conditions of their Theorem 3.5, no other FWER controlling procedure can enlarge the event of rejecting any hypothesis.
ADDIS_exhaustive(d, alpha = 0.05, tau = 0.5, lambda = 0.25, gamma = NULL)ADDIS_exhaustive(d, alpha = 0.05, tau = 0.5, lambda = 0.25, gamma = NULL)
d |
Either a vector of p-values, or a dataframe with at least a
|
alpha |
Overall significance level of the procedure, default 0.05. |
tau |
Optional threshold for hypotheses to be selected for testing. Must be between 0 and 1, defaults to 0.5. |
lambda |
Optional parameter that sets the threshold for ‘candidate’ hypotheses. Must be at least alpha * tau and less than tau, defaults to 0.25. |
gamma |
Optional vector of initial weights, with at least one more
element than the number of p-values and summing to at most 1. If
|
The function takes as its input either a vector of p-values, or a dataframe
with a column of p-values (‘pval’) and optionally an identifier (‘id’).
Given an overall significance level , ADDIS-exhaustive depends
on constants
and , where .
Here represents the threshold for a hypothesis to be selected for testing:
p-values greater than are implicitly ‘discarded’ by the procedure,
while sets the threshold for a p-value to be a
candidate for rejection: ADDIS-exhaustive will never reject a p-value larger
than . The algorithm also requires a sequence of non-negative
numbers that sum to at most 1.
The ADDIS-exhaustive procedure provably controls the FWER in the strong sense for independent p-values.
A dataframe with the original p-values pval, the
per-hypothesis testing levels alphai, and the indicator of
discoveries R.
Lasse Fischer
Fischer, L., Bofill Roig, M. and Brannath, W. (2024). An exhaustive ADDIS principle for online FWER control. Biometrical Journal, 66(3):2300237.
Implements the ADDIS algorithm for online FWER control, where ADDIS stands for an ADaptive algorithm that DIScards conservative nulls, as presented by Tian and Ramdas (2021). The procedure compensates for the power loss of Alpha-spending, by including both adaptivity in the fraction of null hypotheses and the conservativeness of nulls.
ADDIS_spending( d, alpha = 0.05, gammai, lambda = 0.25, tau = 0.5, dep = FALSE, display_progress = FALSE )ADDIS_spending( d, alpha = 0.05, gammai, lambda = 0.25, tau = 0.5, dep = FALSE, display_progress = FALSE )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and lags (‘lags’). |
alpha |
Overall significance level of the procedure, the default is 0.05. |
gammai |
Optional vector of |
lambda |
Optional parameter that sets the threshold for ‘candidate’ hypotheses. Must be between 0 and tau, defaults to 0.25. |
tau |
Optional threshold for hypotheses to be selected for testing. Must be between 0 and 1, defaults to 0.5. |
dep |
Logical. If |
display_progress |
Logical. If |
The function takes as its input either a vector of p-values, or a dataframe
with three columns: an identifier (‘id’), p-value (‘pval’), and lags, if the
dependent version is specified (see below). Given an overall significance
level , ADDIS-spending depends on constants and
, where . Here represents
the threshold for a hypothesis to be selected for testing: p-values greater
than are implicitly ‘discarded’ by the procedure, while
sets the threshold for a p-value to be a candidate for rejection:
ADDIS-spending will never reject a p-value larger than . The
algorithms also require a sequence of non-negative numbers
that sum to 1.
The ADDIS-spending procedure provably controls the FWER in the strong sense
for independent p-values. Note that the procedure also controls the
generalised familywise error rate (k-FWER) for if is
replaced by min().
Tian and Ramdas (2021) also presented a version for handling local
dependence. More precisely, for any we allow the p-value
to have arbitrary dependence on the previous p-values. The fixed
sequence is referred to as ‘lags’, and is given as the input
lags for this version of the ADDIS-spending algorithm. The lags must
satisfy .
Further details of the ADDIS-spending algorithms can be found in Tian and Ramdas (2021).
out |
A dataframe with the original p-values |
Tian, J. and Ramdas, A. (2021). Online control of the familywise error rate. Statistical Methods in Medical Research, 30(4):976-993.
ADDIS provides online control of the FDR.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) ADDIS_spending(sample.df) #independent ADDIS_spending(sample.df, dep = TRUE) #Locally dependentsample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) ADDIS_spending(sample.df) #independent ADDIS_spending(sample.df, dep = TRUE) #Locally dependent
Implements a variant of the Alpha-investing algorithm of Foster and Stine
(2008) that guarantees FDR control, as proposed by Ramdas et al. (2018). This
procedure uses SAFFRON's update rule with the constant replaced
by a sequence . This is also equivalent to using
the ADDIS algorithm with and .
Alpha_investing( d, alpha = 0.05, gammai, w0, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )Alpha_investing( d, alpha = 0.05, gammai, w0, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence. |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
gammai |
Optional vector of |
w0 |
Initial ‘wealth’ of the procedure, defaults to |
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence.
The Alpha-investing procedure provably controls FDR for independent p-values.
Given an overall significance level , we choose a sequence of
non-negative non-increasing numbers that sum to 1.
Alpha-investing depends on a constant , which satisfies and represents the initial ‘wealth’ of the procedure.
Further details of the Alpha-investing procedure and its modification can be found in Foster and Stine (2008) and Ramdas et al. (2018).
out |
A dataframe with the p-values |
Foster, D. and Stine, R. (2008). -investing: a
procedure for sequential control of expected false discoveries.
Journal of the Royal Statistical Society (Series B), 70(2):429-444.
Ramdas, A., Zrnic, T., Wainwright, M.J. and Jordan, M.I. (2018). SAFFRON: an adaptive algorithm for online control of the false discovery rate. Proceedings of the 35th International Conference on Machine Learning, 80:4286-4294.
SAFFRON uses the update rule of Alpha-investing but with
constant .
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) Alpha_investing(sample.df, random=FALSE) set.seed(1); Alpha_investing(sample.df) set.seed(1); Alpha_investing(sample.df, alpha=0.1, w0=0.025)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) Alpha_investing(sample.df, random=FALSE) set.seed(1); Alpha_investing(sample.df) set.seed(1); Alpha_investing(sample.df, alpha=0.1, w0=0.025)
Implements online FWER control using a Bonferroni-like test.
Alpha_spending( d, alpha = 0.05, gammai, random = TRUE, date.format = "%Y-%m-%d" )Alpha_spending( d, alpha = 0.05, gammai, random = TRUE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FWER procedure, the default is 0.05. |
gammai |
Optional vector of |
random |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
Alpha-spending provides strong FWER control for a potentially infinite stream
of p-values by using a Bonferroni-like test. Given an overall significance
level , we choose a (potentially infinite) sequence of
non-negative numbers such that they sum to 1. Hypothesis
is rejected if the -th p-value is less than or equal to
.
Note that the procedure controls the generalised familywise error rate
(k-FWER) for if is replaced by
.
out |
A dataframe with the original data |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Tian, J. and Ramdas, A. (2021). Online control of the familywise error rate. Statistical Methods in Medical Research, 30(4):976-993.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-17, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) set.seed(1); Alpha_spending(sample.df) Alpha_spending(sample.df, random=FALSE) set.seed(1); Alpha_spending(sample.df, alpha=0.1)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-17, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) set.seed(1); Alpha_spending(sample.df) Alpha_spending(sample.df, random=FALSE) set.seed(1); Alpha_spending(sample.df, alpha=0.1)
Implements the BatchBH algorithm for online FDR control, as presented by Zrnic et al. (2020).
BatchBH(d, alpha = 0.05, gammai, display_progress = FALSE)BatchBH(d, alpha = 0.05, gammai, display_progress = FALSE)
d |
A dataframe with three columns: identifiers (‘id’), batch numbers (‘batch’) and p-values (‘pval’). |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
gammai |
Optional vector of |
display_progress |
Logical. If |
The function takes as its input a dataframe with three columns: identifiers (‘id’), batch numbers (‘batch’) and p-values (‘pval’).
The BatchBH algorithm controls the FDR when the p-values in a batch
are independent, and independent across batches. Given an overall
significance level , we choose a sequence of non-negative numbers
such that they sum to 1. The algorithm runs the
Benjamini-Hochberg procedure on each batch, where the values of the adjusted
significance thresholds depend on the number of previous
discoveries.
Further details of the BatchBH algorithm can be found in Zrnic et al. (2020).
out |
A dataframe with the original data |
Zrnic, T., Jiang, D., Ramdas, A. and Jordan, M.I. (2020). The Power of Batching in Multiple Hypothesis Testing. International Conference on Artificial Intelligence and Statistics, PMLR, 108:3806-3815.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchBH(sample.df)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchBH(sample.df)
Implements the BatchPRDS algorithm for online FDR control, where PRDS stands for positive regression dependency on a subset, as presented by Zrnic et al. (2020).
BatchPRDS(d, alpha = 0.05, gammai, display_progress = FALSE)BatchPRDS(d, alpha = 0.05, gammai, display_progress = FALSE)
d |
A dataframe with three columns: identifiers (‘id’), batch numbers (‘batch’) and p-values (‘pval’). |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
gammai |
Optional vector of |
display_progress |
Logical. If |
The function takes as its input a dataframe with three columns: identifiers (‘id’), batch numbers (‘batch’) and p-values (‘pval’).
The BatchPRDS algorithm controls the FDR when the p-values in one batch are
positively dependent, and independent across batches. Given an overall
significance level , we choose a sequence of non-negative numbers
such that they sum to 1. The algorithm runs the
Benjamini-Hochberg procedure on each batch, where the values of the adjusted
significance thresholds depend on the number of previous
discoveries.
Further details of the BatchPRDS algorithm can be found in Zrnic et al. (2020).
out |
A dataframe with the original data |
Zrnic, T., Jiang, D., Ramdas, A. and Jordan, M.I. (2020). The Power of Batching in Multiple Hypothesis Testing. International Conference on Artificial Intelligence and Statistics, PMLR, 108:3806-3815.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchPRDS(sample.df)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchPRDS(sample.df)
Implements the BatchSt-BH algorithm for online FDR control, as presented by Zrnic et al. (2020). Within each batch it uses the Storey-BH procedure (Storey 2002) with the null proportion estimate of Storey, Taylor and Siegmund (2004), which adds 1 to the numerator for more stable results.
BatchStBH(d, alpha = 0.05, gammai, lambda = 0.5, display_progress = FALSE)BatchStBH(d, alpha = 0.05, gammai, lambda = 0.5, display_progress = FALSE)
d |
A dataframe with three columns: identifiers (‘id’), batch numbers (‘batch’) and p-values (‘pval’). |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
gammai |
Optional vector of |
lambda |
Threshold for Storey-BH, must be between 0 and 1. Defaults to 0.5. |
display_progress |
Logical. If |
The function takes as its input a dataframe with three columns: identifiers (‘id’), batch numbers (‘batch’) and p-values (‘pval’).
The BatchSt-BH algorithm controls the FDR when the p-values in a batch are
independent, and independent across batches. Given an overall significance
level , we choose a sequence of non-negative numbers
such that they sum to 1. The algorithm runs the
Storey Benjamini-Hochberg procedure on each batch, where the values of the adjusted
significance thresholds depend on the number of previous
discoveries.
Further details of the BatchSt-BH algorithm can be found in Zrnic et al. (2020).
out |
A dataframe with the original data |
Storey, J.D. (2002). A direct approach to false discovery rates. Journal of the Royal Statistical Society (Series B), 64(3):479-498.
Storey, J.D., Taylor, J.E. and Siegmund, D. (2004). Strong control, conservative point estimation and simultaneous conservative consistency of false discovery rates: a unified approach. Journal of the Royal Statistical Society (Series B), 66(1):187-205.
Zrnic, T., Jiang, D., Ramdas, A. and Jordan, M.I. (2020). The Power of Batching in Multiple Hypothesis Testing. International Conference on Artificial Intelligence and Statistics, PMLR, 108:3806-3815.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchStBH(sample.df)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), batch = c(rep(1,5), rep(2,6), rep(3,4))) BatchStBH(sample.df)
This function is deprecated, please use Alpha_spending instead.
bonfInfinite( d, alpha = 0.05, alphai, random = TRUE, date.format = "%Y-%m-%d" )bonfInfinite( d, alpha = 0.05, alphai, random = TRUE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
alphai |
Optional vector of |
random |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
Implements online FDR control using a Bonferroni-like test.
The function takes as its input either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
The procedure controls FDR for a potentially infinite stream of p-values by
using a Bonferroni-like test. Given an overall significance level
, we choose a (potentially infinite) sequence of non-negative
numbers such that they sum to . Hypothesis
is rejected if the -th p-value is less than or equal to .
d.out |
A dataframe with the original data |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Implements the LOND algorithm for online FDR control, where LOND stands for (significance) Levels based On Number of Discoveries, as presented by Javanmard and Montanari (2015).
LOND( d, alpha = 0.05, betai, dep = FALSE, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d", original = TRUE )LOND( d, alpha = 0.05, betai, dep = FALSE, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d", original = TRUE )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
betai |
Optional vector of |
dep |
Logical. If |
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
original |
Logical. If |
The function takes as its input either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
The LOND algorithm controls the FDR for independent p-values (see below for
the modification for dependent p-values). Given an overall significance level
, we choose a sequence of non-negative numbers such
that they sum to . The values of the adjusted significance
thresholds are chosen as follows:
where denotes the number of discoveries in the first
hypotheses.
A slightly modified version of LOND with thresholds (Javanmard and Montanari, 2015, Remark 2.3)
provably controls the FDR under positive dependence (PRDS condition), see
Zrnic et al. (2021).
For arbitrarily dependent p-values, LOND controls the FDR if it is modified
with in place of , where is the
i-th harmonic number.
Further details of the LOND algorithm can be found in Javanmard and Montanari (2015).
out |
A dataframe with the p-values |
Javanmard, A. and Montanari, A. (2015). On Online Control of False Discovery Rate. arXiv preprint, https://arxiv.org/abs/1502.06197.
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Zrnic, T., Ramdas, A. and Jordan, M.I. (2021). Asynchronous Online Testing of Multiple Hypotheses. Journal of Machine Learning Research, 22(33):1-39.
LONDstar presents versions of LOND for asynchronous
testing, i.e. where each hypothesis test can itself be a sequential process
and the tests can overlap in time.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) set.seed(1); LOND(sample.df) LOND(sample.df, random=FALSE) set.seed(1); LOND(sample.df, alpha=0.1)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) set.seed(1); LOND(sample.df) LOND(sample.df, random=FALSE) set.seed(1); LOND(sample.df, alpha=0.1)
Implements the LOND algorithm for asynchronous online testing, as presented by Zrnic et al. (2021).
LONDstar( d, alpha = 0.05, version, betai, batch.sizes, display_progress = FALSE )LONDstar( d, alpha = 0.05, version, betai, batch.sizes, display_progress = FALSE )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and either ‘decision.times’, or ‘lags’, depending on which version you're using. See version for more details. |
alpha |
Overall significance level of the procedure, the default is 0.05. |
version |
Takes values 'async', 'dep' or 'batch'. This
specifies the version of LONDstar to use. |
betai |
Optional vector of |
batch.sizes |
A vector of batch sizes, this is required for
|
display_progress |
Logical. If |
The function takes as its input either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and a column describing the conflict sets for the hypotheses. This takes the form of a vector of decision times or lags. Batch sizes can be specified as a separate argument (see below).
Zrnic et al. (2021) present three explicit versions of LONDstar:
1) version='async' is for an asynchronous testing
process, consisting of tests that start and finish at (potentially) random
times. The discretised finish times of the tests correspond to the decision
times. These decision times are given as the input decision.times
for this version of the LONDstar algorithm.
2) version='dep' is for online testing under local
dependence of the p-values. More precisely, for any we allow the
p-value to have arbitrary dependence on the previous
p-values. The fixed sequence is referred to as ‘lags’, and is
given as the input lags for this version of the LONDstar algorithm.
3) version='batch' is for controlling the mFDR in
mini-batch testing, where a mini-batch represents a grouping of tests run
asynchronously which result in dependent p-values. Once a mini-batch of tests
is fully completed, a new one can start, testing hypotheses independent of
the previous batch. The batch sizes are given as the input batch.sizes
for this version of the LONDstar algorithm.
Given an overall significance level , LONDstar requires a
sequence of non-negative non-increasing numbers that sum to
.
Note that these LONDstar algorithms control the modified FDR (mFDR).
Further details of the LONDstar algorithms can be found in Zrnic et al. (2021).
out |
A dataframe with the original p-values |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Zrnic, T., Ramdas, A. and Jordan, M.I. (2021). Asynchronous Online Testing of Multiple Hypotheses. Journal of Machine Learning Research, 22(33):1-39.
LOND presents versions of LOND for synchronous p-values,
i.e. where each test can only start when the previous test has finished.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) LONDstar(sample.df, version='async') sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) LONDstar(sample.df2, version='dep') sample.df3 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) LONDstar(sample.df3, version='batch', batch.sizes = c(4,6,5))sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) LONDstar(sample.df, version='async') sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) LONDstar(sample.df2, version='dep') sample.df3 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) LONDstar(sample.df3, version='batch', batch.sizes = c(4,6,5))
Implements the LORD procedure for online FDR control, where LORD stands for (significance) Levels based On Recent Discovery, as presented by Javanmard and Montanari (2018) and Ramdas et al. (2017).
LORD( d, alpha = 0.05, gammai, version = "++", w0, b0, tau.discard = 0.5, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )LORD( d, alpha = 0.05, gammai, version = "++", w0, b0, tau.discard = 0.5, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
gammai |
Optional vector of |
version |
Takes values '++', 3, 'discard', or 'dep'. This specifies the version of LORD to use, and defaults to '++'. |
w0 |
Initial ‘wealth’ of the procedure, defaults to |
b0 |
The ‘payout’ for rejecting a hypothesis in versions 3 and 'dep' of
LORD. Defaults to |
tau.discard |
Optional threshold for hypotheses to be selected for
testing. Must be in (0, 1], defaults to 0.5. This is only used if
|
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
LORD++ and the discarding version of LORD provably control the FDR for
independent p-values; for LORD 3 this has only been shown empirically (see
below for dependent p-values). Given an overall significance level
, we
choose a sequence of non-negative non-increasing numbers that
sum to 1.
Javanmard and Montanari (2018) presented versions of LORD which differ in the
way the adjusted significance thresholds are calculated. The
significance thresholds for LORD 2 are based on all previous discovery times.
LORD 2 has been superseded by the algorithm given in Ramdas et al. (2017),
LORD++ (version='++'), which is the default version. The significance
thresholds for LORD 3 (version=3) are based on the time of the last
discovery as well as the 'wealth' accumulated at that time. Finally, Tian and
Ramdas (2019) presented a version of LORD (version='discard') that can
improve the power of the procedure in the presence of conservative nulls by
adaptively ‘discarding’ these p-values.
LORD depends on constants and (for versions 3 and 'dep') ,
where represents the initial ‘wealth’ of the
procedure and represents the ‘payout’ for rejecting a
hypothesis. We require for FDR control to hold.
Version 'discard' also depends on a constant , where represents the threshold for a hypothesis to be selected for testing:
p-values greater than are implicitly ‘discarded’ by the procedure.
Note that FDR control also holds for the LORD procedure if only the p-values corresponding to true nulls are mutually independent, and independent from the non-null p-values.
For dependent p-values, a modified LORD procedure was proposed in Javanmard
and Montanari (2018), which is called by setting version='dep'. Given
an overall significance level , we choose a sequence of
non-negative numbers (supplied through the argument
gammai) such that if
, which is the condition in Javanmard and Montanari (2018),
example 3.7. If , the condition is instead , which follows from their Theorem 3.6.
Further details of the LORD procedures can be found in Javanmard and Montanari (2018), Ramdas et al. (2017) and Tian and Ramdas (2019).
d.out |
A dataframe with the p-values |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Ramdas, A., Yang, F., Wainwright, M.J. and Jordan, M.I. (2017). Online control of the false discovery rate with decaying memory. Advances in Neural Information Processing Systems 30, 5650-5659.
Tian, J. and Ramdas, A. (2019). ADDIS: an adaptive discarding algorithm for online FDR control with conservative nulls. Advances in Neural Information Processing Systems 32, 9388-9396.
LORDstar presents versions of LORD for asynchronous
testing, i.e. where each hypothesis test can itself be a sequential process
and the tests can overlap in time.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) LORD(sample.df, random=FALSE) set.seed(1); LORD(sample.df, version='dep') set.seed(1); LORD(sample.df, version='discard') set.seed(1); LORD(sample.df, alpha=0.1, w0=0.05)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) LORD(sample.df, random=FALSE) set.seed(1); LORD(sample.df, version='dep') set.seed(1); LORD(sample.df, version='discard') set.seed(1); LORD(sample.df, alpha=0.1, w0=0.05)
This function is deprecated, please use LORD instead with
version = 'dep'.
LORDdep( d, alpha = 0.05, xi, w0 = alpha/10, b0 = alpha - w0, random = TRUE, date.format = "%Y-%m-%d" )LORDdep( d, alpha = 0.05, xi, w0 = alpha/10, b0 = alpha - w0, random = TRUE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
xi |
Optional vector of |
w0 |
Initial ‘wealth’ of the procedure. Defaults to |
b0 |
The ‘payout’ for rejecting a hypothesis. Defaults to |
random |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
LORDdep implements the LORD procedure for online FDR control for dependent p-values, where LORD stands for (significance) Levels based On Recent Discovery, as presented by Javanmard and Montanari (2018).
The function takes as its input either a vector of p-values or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
This modified LORD procedure controls FDR for dependent p-values. Given an
overall significance level , we choose a sequence of non-negative
numbers such that they satisfy a condition given in Javanmard and
Montanari (2018), example 3.7.
The procedure depends on constants and , where represents the initial ‘wealth’ and represents the
‘payout’ for rejecting a hypothesis. We require and
for FDR control to hold.
Further details of the modified LORD procedure can be found in Javanmard and Montanari (2018).
d.out |
A dataframe with the original data |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Implements LORD algorithms for asynchronous online testing, as presented by Zrnic et al. (2021).
LORDstar( d, alpha = 0.05, version, gammai, w0, batch.sizes, display_progress = FALSE )LORDstar( d, alpha = 0.05, version, gammai, w0, batch.sizes, display_progress = FALSE )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and either ‘decision.times’, or ‘lags’, depending on which version you're using. See version for more details. |
alpha |
Overall significance level of the procedure, the default is 0.05. |
version |
Takes values 'async', 'dep' or 'batch'. This specifies the
version of LORDstar to use. |
gammai |
Optional vector of |
w0 |
Initial ‘wealth’ of the procedure, defaults to |
batch.sizes |
A vector of batch sizes, this is required for
|
display_progress |
Logical. If |
The function takes as its input either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and a column describing the conflict sets for the hypotheses. This takes the form of a vector of decision times or lags. Batch sizes can be specified as a separate argument (see below).
Zrnic et al. (2021) present three explicit versions of LORDstar:
1) version='async' is for an asynchronous testing process, consisting
of tests that start and finish at (potentially) random times. The discretised
finish times of the tests correspond to the decision times. These decision
times are given as the input decision.times for this version of the
LORDstar algorithm.
2) version='dep' is for online testing under local dependence of the
p-values. More precisely, for any we allow the p-value to
have arbitrary dependence on the previous p-values. The fixed
sequence is referred to as ‘lags’, and is given as the input
lags for this version of the LORDstar algorithm.
3) version='batch' is for controlling the mFDR in mini-batch testing,
where a mini-batch represents a grouping of tests run asynchronously which
result in dependent p-values. Once a mini-batch of tests is fully completed,
a new one can start, testing hypotheses independent of the previous batch.
The batch sizes are given as the input batch.sizes for this version of
the LORDstar algorithm.
Given an overall significance level , LORDstar depends on
(where ), which represents the initial
‘wealth’ of the procedure. The algorithms also require a sequence of
non-negative non-increasing numbers that sum to 1.
Note that these LORDstar algorithms control the modified FDR (mFDR). The ‘async’ version also controls the usual FDR if the p-values are assumed to be independent.
Further details of the LORDstar algorithms can be found in Zrnic et al. (2021).
out |
A dataframe with the original p-values |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Zrnic, T., Ramdas, A. and Jordan, M.I. (2021). Asynchronous Online Testing of Multiple Hypotheses. Journal of Machine Learning Research, 22(33):1-39.
LORD presents versions of LORD for synchronous p-values,
i.e. where each test can only start when the previous test has finished.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) LORDstar(sample.df, version='async') sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) LORDstar(sample.df2, version='dep')sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) LORDstar(sample.df, version='async') sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) LORDstar(sample.df2, version='dep')
Implements the online fallback procedure of Tian and Ramdas (2021), which guarantees strong FWER control under arbitrary dependence of the p-values.
online_fallback( d, alpha = 0.05, gammai, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )online_fallback( d, alpha = 0.05, gammai, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FWER procedure, the default is 0.05. |
gammai |
Optional vector of |
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values or a dataframe
with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’).
The case where p-values arrive in batches corresponds to multiple instances
of the same date. If no column of dates is provided, then the p-values are
treated as being ordered in sequence, arriving one at a time. Given an overall
significance level , we choose a sequence of non-negative
non-increasing numbers that sum to 1.
The online fallback procedure provides a uniformly more powerful method than
Alpha-spending, by saving the significance level of a previous rejection.
More specifically, the procedure tests hypothesis at level
for ,
with , where denotes a rejected hypothesis.
Further details of the online fallback procedure can be found in Tian and Ramdas (2021).
out |
A dataframe with the p-values |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Tian, J. and Ramdas, A. (2021). Online control of the familywise error rate. Statistical Methods in Medical Research, 30(4):976-993.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) online_fallback(sample.df, random=FALSE) set.seed(1); online_fallback(sample.df) set.seed(1); online_fallback(sample.df, alpha=0.1)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) online_fallback(sample.df, random=FALSE) set.seed(1); online_fallback(sample.df) set.seed(1); online_fallback(sample.df, alpha=0.1)
These functions are provided for compatibility with older versions of ‘onlineFDR’ only, and will be defunct at the next release.
The following functions are deprecated and will be made defunct; use the replacement indicated below:
LORDdep: LORD with version='dep'
bonfInfinite: Alpha_spending
A dataframe with the p-values, the adjusted significance thresholds
alphai and the indicator function of discoveries R, as for
the replacement functions.
Implements the SAFFRON procedure for online FDR control, where SAFFRON stands for Serial estimate of the Alpha Fraction that is Futilely Rationed On true Null hypotheses, as presented by Ramdas et al. (2018). The algorithm is based on an estimate of the proportion of true null hypotheses. More precisely, SAFFRON sets the adjusted test levels based on an estimate of the amount of alpha-wealth that is allocated to testing the true null hypotheses.
SAFFRON( d, alpha = 0.05, gammai, w0, lambda = 0.5, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )SAFFRON( d, alpha = 0.05, gammai, w0, lambda = 0.5, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
gammai |
Optional vector of |
w0 |
Initial ‘wealth’ of the procedure, defaults to |
lambda |
Optional threshold for a ‘candidate’ hypothesis, must be between 0 and 1. Defaults to 0.5. |
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
The SAFFRON procedure provably controls the FDR for independent p-values.
Given an overall significance level , we choose a sequence of non-negative
non-increasing numbers that sum to 1.
SAFFRON depends on constants and , where
satisfies and represents the initial ‘wealth’ of
the procedure, and represents the threshold for a
‘candidate’ hypothesis. A ‘candidate’ refers to p-values no larger than
, since SAFFRON will never reject a p-value larger than
.
Note that FDR control also holds for the SAFFRON procedure if only the p-values corresponding to true nulls are mutually independent, and independent from the non-null p-values.
The SAFFRON procedure can lose power in the presence of conservative nulls,
which can be compensated for by adaptively ‘discarding’ these p-values, as
in the ADDIS algorithm (see ADDIS).
Further details of the SAFFRON procedure can be found in Ramdas et al. (2018).
out |
A dataframe with the p-values |
Ramdas, A., Zrnic, T., Wainwright, M.J. and Jordan, M.I. (2018). SAFFRON: an adaptive algorithm for online control of the false discovery rate. Proceedings of the 35th International Conference on Machine Learning, 80:4286-4294.
SAFFRONstar presents versions of SAFFRON for
asynchronous testing, i.e. where each hypothesis test can itself be a
sequential process and the tests can overlap in time.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) SAFFRON(sample.df, random=FALSE) set.seed(1); SAFFRON(sample.df) set.seed(1); SAFFRON(sample.df, alpha=0.1, w0=0.025)sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), date = as.Date(c(rep('2014-12-01',3), rep('2015-09-21',5), rep('2016-05-19',2), '2016-11-12', rep('2017-03-27',4))), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757)) SAFFRON(sample.df, random=FALSE) set.seed(1); SAFFRON(sample.df) set.seed(1); SAFFRON(sample.df, alpha=0.1, w0=0.025)
Implements the SAFFRON algorithm for asynchronous online testing, as presented by Zrnic et al. (2021).
SAFFRONstar( d, alpha = 0.05, version, gammai, w0, lambda = 0.5, batch.sizes, display_progress = FALSE )SAFFRONstar( d, alpha = 0.05, version, gammai, w0, lambda = 0.5, batch.sizes, display_progress = FALSE )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and either ‘decision.times’, or ‘lags’, depending on which version you're using. See version for more details. |
alpha |
Overall significance level of the procedure, the default is 0.05. |
version |
Takes values 'async', 'dep' or 'batch'. This specifies the
version of SAFFRONstar to use. |
gammai |
Optional vector of |
w0 |
Initial ‘wealth’ of the procedure, defaults to |
lambda |
Optional threshold for a ‘candidate’ hypothesis, must be between 0 and 1. Defaults to 0.5. |
batch.sizes |
A vector of batch sizes, this is required for
|
display_progress |
Logical. If |
The function takes as its input either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), p-value (‘pval’), and a column describing the conflict sets for the hypotheses. This takes the form of a vector of decision times or lags. Batch sizes can be specified as a separate argument (see below).
Zrnic et al. (2021) present three explicit versions of SAFFRONstar:
1) version='async' is for an asynchronous testing process, consisting
of tests that start and finish at (potentially) random times. The discretised
finish times of the tests correspond to the decision times. These decision
times are given as the input decision.times for this version of the
SAFFRONstar algorithm. For this version of SAFFRONstar, Tian and Ramdas
(2019) presented an algorithm that can improve the power of the procedure in
the presence of conservative nulls by adaptively ‘discarding’ these p-values.
This is implemented by ADDIS with async=TRUE.
2) version='dep' is for online testing under local dependence of the
p-values. More precisely, for any we allow the p-value to
have arbitrary dependence on the previous p-values. The fixed
sequence is referred to as ‘lags’, and is given as the input
lags for this version of the SAFFRONstar algorithm.
3) version='batch' is for controlling the mFDR in mini-batch testing,
where a mini-batch represents a grouping of tests run asynchronously which
result in dependent p-values. Once a mini-batch of tests is fully completed,
a new one can start, testing hypotheses independent of the previous batch.
The batch sizes are given as the input batch.sizes for this version of
the SAFFRONstar algorithm.
Given an overall significance level , SAFFRONstar depends on
constants and , where satisfies and represents the initial ‘wealth’ of the
procedure, and represents the threshold for a
‘candidate’ hypothesis. A ‘candidate’ refers to p-values no larger than
, since SAFFRONstar will never reject a p-value larger than
. The algorithms also require a sequence of non-negative
non-increasing numbers that sum to 1.
Note that these SAFFRONstar algorithms control the modified FDR (mFDR). The ‘async’ version also controls the usual FDR if the p-values are assumed to be independent.
Further details of the SAFFRONstar algorithms can be found in Zrnic et al. (2021).
out |
A dataframe with the original p-values |
Tian, J. and Ramdas, A. (2019). ADDIS: an adaptive discarding algorithm for online FDR control with conservative nulls. Advances in Neural Information Processing Systems 32, 9388-9396.
Zrnic, T., Ramdas, A. and Jordan, M.I. (2021). Asynchronous Online Testing of Multiple Hypotheses. Journal of Machine Learning Research, 22(33):1-39.
SAFFRON presents versions of SAFFRON for synchronous
p-values, i.e. where each test can only start when the previous test has
finished.
sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) SAFFRONstar(sample.df, version='async') sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) SAFFRONstar(sample.df2, version='dep')sample.df <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), decision.times = seq_len(15) + 1) SAFFRONstar(sample.df, version='async') sample.df2 <- data.frame( id = c('A15432', 'B90969', 'C18705', 'B49731', 'E99902', 'C38292', 'A30619', 'D46627', 'E29198', 'A41418', 'D51456', 'C88669', 'E03673', 'A63155', 'B66033'), pval = c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757), lags = rep(1,15)) SAFFRONstar(sample.df2, version='dep')
Calculates a default sequence of non-negative numbers that sum
to 1 (for LOND and LONDstar, a sequence that sums to
), given an upper bound on the number of hypotheses to be
tested.
For LORDdep the sequence instead satisfies , the condition in Javanmard and Montanari (2018),
example 3.7, for LORD(version='dep').
setBound(alg, alpha = 0.05, N)setBound(alg, alpha = 0.05, N)
alg |
A string that takes the value of one of the following: LOND, LORD, LORDdep, SAFFRON, ADDIS, LONDstar, LORDstar, SAFFRONstar, Alpha_investing, Alpha_spending, ADDIS_spending or online_fallback |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. The bounds for LOND and LONDstar depend on alpha. |
N |
An upper bound on the number of hypotheses to be tested |
bound |
A vector giving the values of a default sequence
|
Implements the Storey-BH algorithm for offline FDR control, as presented by Storey (2002), with the null proportion estimate of Storey, Taylor and Siegmund (2004).
StoreyBH(d, alpha = 0.05, lambda = 0.5)StoreyBH(d, alpha = 0.05, lambda = 0.5)
d |
Either a vector of p-values, or a dataframe with the column: p-value (‘pval’). |
alpha |
Overall significance level of the FDR procedure, the default is 0.05. |
lambda |
Threshold for Storey-BH, must be in (0, 1). Defaults to 0.5. |
The function takes as its input either a vector of p-values, or a dataframe with a column of p-values (‘pval’).
out |
A dataframe with the original data |
Storey, J.D. (2002). A direct approach to false discovery rates. Journal of the Royal Statistical Society (Series B), 64(3):479-498.
Storey, J.D., Taylor, J.E. and Siegmund, D. (2004). Strong control, conservative point estimation and simultaneous conservative consistency of false discovery rates: a unified approach. Journal of the Royal Statistical Society (Series B), 66(1):187-205.
pvals <- c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757) StoreyBH(pvals)pvals <- c(2.90e-08, 0.06743, 0.01514, 0.08174, 0.00171, 3.60e-05, 0.79149, 0.27201, 0.28295, 7.59e-08, 0.69274, 0.30443, 0.00136, 0.72342, 0.54757) StoreyBH(pvals)
Implements the supLORD procedure, which controls both FDX and FDR, including the FDR at stopping times, as presented by Xu and Ramdas (2021).
supLORD( d, delta = 0.05, eps, r, eta, rho, gammai, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )supLORD( d, delta = 0.05, eps, r, eta, rho, gammai, random = TRUE, display_progress = FALSE, date.format = "%Y-%m-%d" )
d |
Either a vector of p-values, or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time. |
delta |
Upper bound on the probability that the FDP exceeds eps (at any time step after making r rejections). Must be between 0 and 1, defaults to 0.05. |
eps |
The upper bound on the FDP. Must be between 0 and 1. |
r |
The threshold of rejections after which the error control begins to apply. Must be a positive integer. |
eta |
Controls the pace at which wealth is spent as a function of the algorithm's current wealth. Must be a positive real number. |
rho |
Controls the length of time before the spending sequence exhausts
the wealth earned from a rejection. Must be a positive integer, no greater
than the length of a user-supplied |
gammai |
Optional vector of |
random |
Logical. If |
display_progress |
Logical. If |
date.format |
Optional string giving the format that is used for dates. |
The function takes as its input either a vector of p-values or a dataframe with three columns: an identifier (‘id’), date (‘date’) and p-value (‘pval’). The case where p-values arrive in batches corresponds to multiple instances of the same date. If no column of dates is provided, then the p-values are treated as being ordered in sequence, arriving one at a time.
The supLORD procedure provably controls the FDX for p-values that are
conditionally superuniform under the null. supLORD also controls the supFDR
and hence the FDR (even at stopping times). Given an overall significance
level , we choose a sequence of non-negative non-increasing
numbers that sum to 1.
supLORD requires the user to specify r, a threshold of rejections after which the error control begins to apply, eps, the upper bound on the false discovery proportion (FDP), and delta, an upper bound on the probability that the FDP exceeds eps at any time step after making r rejections. As well, the user should specify the variables eta, which controls the pace at which wealth is spent (as a function of the algorithm's current wealth), and rho, which controls the length of time before the spending sequence exhausts the wealth earned from a rejection.
The test levels follow the dynamic alpha schedule of Xu and Ramdas (2021),
equations 16 and 17, with the default boost sequence of their Appendix A,
equation 21: the initial wealth and each of the first r - 1 rejections earn
, and the r-th and later rejections earn
, where . The
offset is the canonical solution of their equation 20.
Further details of the supLORD procedure can be found in Xu and Ramdas (2021).
d.out |
A dataframe with the original data |
Javanmard, A. and Montanari, A. (2018). Online Rules for Control of False Discovery Rate and False Discovery Exceedance. Annals of Statistics, 46(2):526-554.
Xu, Z. and Ramdas, A. (2021). Dynamic Algorithms for Online Multiple Testing. Annual Conference on Mathematical and Scientific Machine Learning, PMLR, 145:955-986.
set.seed(1) N <- 1000 B <- rbinom(N, 1, 0.5) Z <- rnorm(N, mean = 3*B) pval <- pnorm(-Z) out <- supLORD(pval, eps=0.15, r=30, eta=0.05, rho=30, random=FALSE) head(out) sum(out$R)set.seed(1) N <- 1000 B <- rbinom(N, 1, 0.5) Z <- rnorm(N, mean = 3*B) pval <- pnorm(-Z) out <- supLORD(pval, eps=0.15, r=30, eta=0.05, rho=30, random=FALSE) head(out) sum(out$R)