Package 'renyi'

Title: Renyi Outlier Test
Description: renyi implements the Renyi Outlier Test <arXiv:2411.13542>, an outlier test designed for modern large scale testing applications, especially where prior information available. The test combines a vector of independent uniform p-values into one p-value with power against alternatives where a small number of p-values are non-null. The test can leverage prior probabilities/weights specifying which variables are likely to be outliers and prior estimates of effect size. The procedure is fast even when the number of initial p-values is large (e.g. in the millions) and numerically stable even for very small p-values (e.g. 10^-300).
Authors: Ryan Christ <[email protected]>
Maintainer: Ryan Christ <[email protected]>
License: Apache License (>= 2)
Version: 1.0.0
Built: 2025-02-01 05:43:19 UTC
Source: https://github.com/ryanchrist/renyi

Help Index


Generalized Renyi Transform

Description

A Generalization of Aldous Renyi's representation of exponential order statistics

Usage

generalized_renyi_transform(x, eta = NULL, zeta = NULL)

Arguments

x

a vector of independent exponential random variables of the form Xj=ηjYj+ζjX_j = \eta_j Y_j + \zeta_j where each XjX_j is an independent exponential random variable with rate 1

eta

vector of scale parameters implicit in the construction of x: eta[j] = ηj\eta_j

zeta

vector of shift parameters implicit in the construction of x: zeta[j] = ζj\zeta_j

Details

Maps a vector of shifted and scaled independent exponential random variables to a sequence of standard independent exponential random variables based on the gaps (jumps) between the initial random variables

Value

a list containing two elements

'exps'

a vector of independent standard exponentials where exps[1] is the exponential jump corresponding to min(x) and tail(exps,1) is the exponential jump corresponding to max(x).

'order'

order(x).

References

Christ, R., Hall, I. and Steinsaltz, D. (2024) "The Renyi Outlier Test", arXiv:2411.13542 . Available at: doi:10.48550/arXiv.2411.13542.

Examples

# example code

a <- rchisq(10,1)
b <- rnorm(10)
xx <- a*rexp(10)+b
generalized_renyi_transform(xx, a, b)

Renyi Outlier Test

Description

A fast, numerically precise outlier test for a vector of exact p-values allowing for prior information

Usage

renyi(u, k = ceiling(0.01 * length(u)), pi = NULL, eta = NULL)

Arguments

u

a vector of p-values

k

a rough upper bound on the number of outliers expected to be present in u

pi

optional vector such that pi[j] is proportional to the probability that u[j] is an outlier. The default, NULL, corresponds to pi = rep_len(1,length(u)).

eta

optional vector proportional to how far outlying we expect u[j] to be given u[j] is an outlier. More precisely, in the common context where each element of u can be thought of as a p-value for testing whether some coefficient β\beta in a linear regression model is zero, we assume eta[j] is proportional to E[βj2βj0]\mathbb{E}\left[\left. \beta_j^2 \right| \beta_j \neq 0\right]. The default, NULL, corresponds to eta = rep_len(1,length(u)).

Details

The about which p-values are outlying and "how much" of an outlier they are expected to be

Value

a list containing three elements

'p_value'

the p-value returned by the Renyi Outlier Test;

'exit_status'

a character string describing any problems that may have been encountered during evaluation, "default is no problems";

'u'

the vector of p-values used by the outlier test after adjusting the u provided for pi and eta.

References

Christ, R., Hall, I. and Steinsaltz, D. (2024) "The Renyi Outlier Test", arXiv:2411.13542 . Available at: doi:10.48550/arXiv.2411.13542.

Examples

# example code

p <- 1e4
u <- runif(p)
u[c(53,88,32)] <- 1e-6 # add a few outliers
renyi(u)$p_value # test for outliers without any prior knowledge
renyi(u,pi=c(rep(1,100),rep(10^-3,p-100)))$p_value # test for outliers with prior knowledge