| Title: | Post Hoc Bounds on True Discoveries for Gaussian Tests |
|---|---|
| Description: | Computes lower confidence bounds on the number of true discoveries in any selection of hypotheses, chosen after seeing the data, from independent one-sided Gaussian test statistics. The bounds hold simultaneously over all selections, as in the post hoc inference of Goeman and Solari (2011) <doi:10.1214/11-STS356>. The bound on all hypotheses is the smallest of the Sidak bound, closed testing with the largest p-value as local test, and bounds from counts of statistics above thresholds and from a centered statistic that gathers many weak signals. For a selection, the bound also uses a reference family of p-value levels as in Blanchard, Neuvial and Roquain (2020) <doi:10.1214/19-AOS1847>. The package reports bounds for the most significant hypotheses and a bound on the false discovery proportion for each hypothesis, and it also covers statistics that are dependent within independent blocks of bounded size. |
| Authors: | Satoshi Nakamura [aut, cre] |
| Maintainer: | Satoshi Nakamura <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.1.0 |
| Built: | 2026-11-27 23:53:39 UTC |
| Source: | https://github.com/cran/posthocbounds |
The package computes lower confidence bounds on the number of true discoveries in selections of hypotheses from one-sided Gaussian test statistics. The bounds hold simultaneously over all selections, so a selection may be chosen after looking at the data.
Start with combined_bound, which takes the statistics or the
one-sided p-values and prints the main results. The other functions read the
result:
true_discoveries: bounds for any selections.
ranked_bounds: bounds for the most significant
hypotheses, for every .
hypothesis_table: one row per hypothesis, with a bound
on the false discovery proportion to report next to its p-value.
select_by_fdp: the largest list of most significant
hypotheses with a given bound on the false discovery proportion.
plot: the confidence envelope.
The data set dialysis gives an example with 6641 dialysis
facilities.
Satoshi Nakamura [email protected]
Computes, from one-sided Gaussian test statistics, lower confidence bounds on the number of true discoveries that hold simultaneously for every selection of hypotheses, including selections made after looking at the data.
combined_bound(z = NULL, p = NULL, alpha = 0.05, block_size = 1, equal_blocks = FALSE) ## S3 method for class 'combined_bound' print(x, ...) ## S3 method for class 'combined_bound' summary(object, ...)combined_bound(z = NULL, p = NULL, alpha = 0.05, block_size = 1, equal_blocks = FALSE) ## S3 method for class 'combined_bound' print(x, ...) ## S3 method for class 'combined_bound' summary(object, ...)
z |
numeric vector of test statistics, one per hypothesis. Large values are evidence against the null hypothesis. Names, if present, are used as hypothesis labels. |
p |
numeric vector of one-sided p-values, as an alternative to
|
alpha |
error level; the bounds hold simultaneously with probability at
least |
block_size |
largest number of statistics in a block of dependent statistics. The default 1 means that all statistics are independent. See Details. |
equal_blocks |
logical; set to |
x, object
|
a result of |
... |
not used. |
Statistic follows a Gaussian distribution with mean
and variance 1, and hypothesis has the null hypothesis
. A selected hypothesis is a true discovery when
and a false discovery otherwise. The statistics must be
independent, or, when block_size = b > 1, fall into independent blocks
of at most statistics with any dependence inside a block. The
procedure needs only , not the blocks themselves.
With probability at least 1 - alpha, every selection of the
hypotheses contains at least the reported number of true discoveries, for all
selections at once. Selections may therefore be chosen after looking at the
data, and several selections may be reported together.
The bound on the number of false discoveries among all hypotheses is
the smallest of the following component bounds, each computed at level
alpha/4:
the number of statistics below the Sidak cutoff
(the Bonferroni cutoff
when block_size > 1);
closed testing with the largest p-value as local test;
two bounds from the numbers of statistics above a grid of thresholds,
with Bernstein and with Chernoff tolerances, and a bound from a centered
statistic that gathers many weak signals; these three share one union
bound at level alpha/4.
For a selection , the bound on the false discoveries in is the
smallest of , rounded down, the number of hypotheses in
below the cutoff, and a reference family bound at level
alpha/4 that counts the p-values of above a grid of levels
. The bound on true discoveries is
minus this number.
When many hypotheses carry weak signals, the threshold counts and the centered statistic can make the bound on the number of false discoveries much smaller than the Sidak bound and the bound of closed testing with Simes local tests.
An object of class "combined_bound", a list with components
m |
number of hypotheses. |
alpha, block_size, equal_blocks
|
the arguments. |
z, p_value
|
statistics and one-sided p-values. |
labels |
hypothesis labels, or |
components |
named vector of the component bounds on the number of false
discoveries among all hypotheses ( |
bound |
the combined bound |
false_all |
the bound on false discoveries among all hypotheses,
|
z_cutoff |
the cutoff for individual significance. |
significant |
logical vector; |
call |
the call. |
Use true_discoveries, ranked_bounds,
hypothesis_table and select_by_fdp to read the
bounds, and plot to draw them.
Goeman, J. J. and Solari, A. (2011). Multiple testing for exploratory research. Statistical Science, 26, 584–597. doi:10.1214/11-STS356
Blanchard, G., Neuvial, P. and Roquain, E. (2020). Post hoc confidence bounds on false positives using reference families. The Annals of Statistics, 48, 1281–1303. doi:10.1214/19-AOS1847
Sidak, Z. (1967). Rectangular confidence regions for the means of multivariate normal distributions. Journal of the American Statistical Association, 62, 626–633. doi:10.1080/01621459.1967.10482935
true_discoveries, ranked_bounds,
hypothesis_table, select_by_fdp,
plot.combined_bound
## 2000 hypotheses, 300 of them with a weak signal set.seed(1) z <- rnorm(2000, mean = c(rep(2, 300), rep(0, 1700))) fit <- combined_bound(z) fit summary(fit) ## the same data given as one-sided p-values fit_p <- combined_bound(p = pnorm(z, lower.tail = FALSE)) fit_p$false_all == fit$false_all ## dialysis facilities: mortality below 1.2 times the national rate se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) fit## 2000 hypotheses, 300 of them with a weak signal set.seed(1) z <- rnorm(2000, mean = c(rep(2, 300), rep(0, 1700))) fit <- combined_bound(z) fit summary(fit) ## the same data given as one-sided p-values fit_p <- combined_bound(p = pnorm(z, lower.tail = FALSE)) fit_p$false_all == fit$false_all ## dialysis facilities: mortality below 1.2 times the national rate se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) fit
Risk adjusted mortality rates of 6641 dialysis facilities in the United States, with their 95 percent confidence limits, from the Dialysis Facility Compare data of the Centers for Medicare and Medicaid Services.
dialysisdialysis
A data frame with 6641 rows and 7 columns:
two letter state code.
factor, "for-profit" or "non-profit".
logical; TRUE if the facility belongs to a chain.
number of patients included in the survival summary.
risk adjusted mortality rate, in percent.
limits of the published 95 percent confidence interval for the mortality rate, in percent.
The rows are the facilities with survival data (availability code 001), at least 100 patients in the survival summary and positive mortality rate and lower limit. The national mortality rate of the same release is 22.2 percent.
Treating each published interval as a Gaussian interval on the log scale gives
the standard error (log(upper) - log(lower)) / (2 * qnorm(0.975)) of the
log rate. For a margin , the statistic
(log(c * 22.2) - log(mortality)) / se tests the null hypothesis that the
mortality rate of the facility is at least times the national rate;
the examples use .
Centers for Medicare and Medicaid Services, Provider Data Catalog, “Dialysis Facility - Listing by Facility” (dataset 23ew-n7w9, release of 16 June 2026, file ‘DFC_FACILITY.csv’), https://data.cms.gov/provider-data/dataset/23ew-n7w9. The data are works of the United States government and are in the public domain.
se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se summary(z)se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se summary(z)
Lists each hypothesis with its statistic, its p-value, its rank, whether it is significant individually, and a bound on the false discovery proportion (FDP) that can be reported next to its p-value.
hypothesis_table(fit, sort = FALSE)hypothesis_table(fit, sort = FALSE)
fit |
a result of |
sort |
logical; if |
For the hypothesis of rank , fdp_at_most is the smallest FDP
bound among the selections of the most significant hypotheses with
, that is, among the lists of most significant hypotheses that
contain it. It is built in the same way as the q-value of Storey (2003) from
the FDP bounds of ranked_bounds, and it is nondecreasing in the
rank. With probability at least 1 - alpha, for every level at
once, the hypotheses with fdp_at_most <= q have a false discovery
proportion of at most .
A data frame with the columns
hypothesis |
label, or index if the statistics had no names. |
z |
statistic. |
p_value |
one-sided p-value, not adjusted for multiplicity. |
rank |
rank from the largest statistic. |
significant |
|
fdp_at_most |
bound on the false discovery proportion, as in Details. |
Storey, J. D. (2003). The positive false discovery rate: a Bayesian interpretation and the q-value. The Annals of Statistics, 31, 2013–2035. doi:10.1214/aos/1074290335
se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) head(hypothesis_table(fit, sort = TRUE))se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) head(hypothesis_table(fit, sort = TRUE))
Draws the lower bound on the number of true discoveries among the most
significant hypotheses against , with the line of slope 1 for
reference.
## S3 method for class 'combined_bound' plot(x, log = "", xlab = "Number of most significant hypotheses (k)", ylab = "True discoveries, at least", main = NULL, ...)## S3 method for class 'combined_bound' plot(x, log = "", xlab = "Number of most significant hypotheses (k)", ylab = "True discoveries, at least", main = NULL, ...)
x |
a result of |
log |
passed to |
xlab, ylab, main
|
axis labels and title. |
... |
further arguments passed to |
x, invisibly.
set.seed(1) z <- rnorm(2000, mean = c(rep(2, 300), rep(0, 1700))) plot(combined_bound(z))set.seed(1) z <- rnorm(2000, mean = c(rep(2, 300), rep(0, 1700))) plot(combined_bound(z))
Reports, for each , the bounds for the selection of the
hypotheses with the largest statistics. As a function of , the lower
bound on true discoveries is a confidence envelope.
ranked_bounds(fit, k = NULL)ranked_bounds(fit, k = NULL)
fit |
a result of |
k |
numbers of most significant hypotheses; the default |
Ties among the statistics are broken by the order of the input. The bounds
hold simultaneously for all , and for all other selections, with
probability at least 1 - alpha.
A data frame with the columns
k |
number of most significant hypotheses. |
z_k |
the |
true_at_least |
lower bound on the number of true discoveries among them. |
false_at_most |
upper bound on the number of false discoveries among them. |
fdp_at_most |
upper bound on their false discovery proportion. |
combined_bound, plot.combined_bound,
hypothesis_table
set.seed(1) z <- rnorm(2000, mean = c(rep(2, 300), rep(0, 1700))) fit <- combined_bound(z) ranked_bounds(fit, k = c(10, 50, 100, 200, 300, 500))set.seed(1) z <- rnorm(2000, mean = c(rep(2, 300), rep(0, 1700))) fit <- combined_bound(z) ranked_bounds(fit, k = c(10, 50, 100, 200, 300, 500))
Returns the largest selection of most significant hypotheses whose bound on
the false discovery proportion (FDP) is at most fdp.
select_by_fdp(fit, fdp = 0.1)select_by_fdp(fit, fdp = 0.1)
fit |
a result of |
fdp |
the largest FDP bound allowed, between 0 and 1. |
The selection consists of the hypotheses whose fdp_at_most in
hypothesis_table is at most fdp. With probability at
least 1 - alpha, the FDP of the returned selection is at most
fdp for every value of fdp at once.
An integer vector of hypothesis indices, from the most significant, named by the hypothesis labels when they exist. It is empty when no selection meets the bound.
hypothesis_table, true_discoveries
se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) top <- select_by_fdp(fit, fdp = 0.1) length(top) true_discoveries(fit, top)se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) top <- select_by_fdp(fit, fdp = 0.1) length(top) true_discoveries(fit, top)
Reports, for one or more selections of hypotheses, the lower bound on the number of true discoveries, the upper bound on the number of false discoveries and the upper bound on the false discovery proportion (FDP).
true_discoveries(fit, select = NULL, by = NULL, details = FALSE)true_discoveries(fit, select = NULL, by = NULL, details = FALSE)
fit |
a result of |
select |
a selection, or a list of selections. A selection is a vector
of indices, a logical vector with one value per hypothesis, or a vector of
hypothesis labels. The default |
by |
alternatively to |
details |
logical; if |
The bounds hold simultaneously for all selections with probability at least
1 - alpha, so the selections may be chosen after looking at the data
and reported together.
A data frame with one row per selection and the columns
selection |
name of the selection. |
selected |
number of hypotheses in the selection. |
true_at_least |
lower bound on the number of true discoveries. |
false_at_most |
upper bound on the number of false discoveries. |
fdp_at_most |
upper bound on the false discovery proportion,
|
With details = TRUE, also
from_all |
the bound on false discoveries among all hypotheses, capped at the selection size. |
from_cutoff |
the number of selected hypotheses below the cutoff for individual significance. |
from_pvalues |
the reference family bound from the selected p-values. |
se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) ## all facilities, and the facilities of two states true_discoveries(fit) true_discoveries(fit, list(California = dialysis$state == "CA", `New York` = dialysis$state == "NY")) ## one selection per ownership type, with the parts of the bound true_discoveries(fit, by = dialysis$ownership, details = TRUE)se <- (log(dialysis$upper) - log(dialysis$lower)) / (2 * qnorm(0.975)) z <- (log(1.2 * 22.2) - log(dialysis$mortality)) / se fit <- combined_bound(z) ## all facilities, and the facilities of two states true_discoveries(fit) true_discoveries(fit, list(California = dialysis$state == "CA", `New York` = dialysis$state == "NY")) ## one selection per ownership type, with the parts of the bound true_discoveries(fit, by = dialysis$ownership, details = TRUE)