| Title: | Exact and Log-Scale Tail Probabilities for Roy's Largest Root |
|---|---|
| Description: | Provides distribution functions and log-scale tail probabilities for Roy's largest root in single and double Wishart (Jacobi ensemble) settings. This package is derived from the 'rootWishart' package by Maxime Turgeon and extends it with numerically robust log-CDF/log-survival evaluation, tail-aware adaptive precision, and high-dimensional validation utilities, based on Chiani (2014) <DOI:10.1016/j.jmva.2014.04.002> and Chiani (2016) <DOI:10.1016/j.jmva.2015.10.007>. |
| Authors: | Stepan Grinek [aut, cre], Maxime Turgeon [ctb] (Original rootWishart package codebase) |
| Maintainer: | Stepan Grinek <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.95.2 |
| Built: | 2026-07-17 06:32:54 UTC |
| Source: | https://github.com/stepanv1/rootwisharthd |
Computes the CDF for Roy's largest root in the real double-Wishart/Jacobi ensemble.
doubleWishart(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, p = NULL)doubleWishart(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, p = NULL)
x |
Numeric vector of evaluation points on the Jacobi scale |
s |
Integer matrix dimension in Chiani's parameterization. |
p |
Optional alias for |
m, n
|
Shape/ensemble parameters in Chiani's Pfaffian formulation. |
type |
|
verbose |
Logical; if |
force_multiprecision |
Logical; if |
force_mpfr |
Deprecated alias for |
The CRAN-safe default multiprecision backend is Boost's header-only cpp_dec_float from BH (compiled with DW_USE_MPFR=0). Local source builds can opt in to MPFR/GMP by installing those libraries and using DW_USE_MPFR=1 R CMD INSTALL rootWishartHD_*.tar.gz. See rootWishartHD_mpfr_enabled() and the README.
Numeric vector of CDF values in the same order as x.
x <- seq(0.1, 0.9, length.out = 5) doubleWishart(x, s = 2, m = 6, n = 9, type = "double", verbose = FALSE)x <- seq(0.1, 0.9, length.out = 5) doubleWishart(x, s = 2, m = 6, n = 9, type = "double", verbose = FALSE)
Returns log-scale probabilities for the double-Wishart largest root, avoiding 0/1 saturation in extreme tails.
doubleWishart_log(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), tail = c("lower", "upper"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, direct_b = FALSE, scale_iter = 5L, pf_method = c("auto", "gauss", "svd", "schur", "lu"), adaptive = FALSE, start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-30, use_arb = FALSE, p = NULL)doubleWishart_log(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), tail = c("lower", "upper"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, direct_b = FALSE, scale_iter = 5L, pf_method = c("auto", "gauss", "svd", "schur", "lu"), adaptive = FALSE, start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-30, use_arb = FALSE, p = NULL)
x |
Numeric vector on the Jacobi |
s, p, m, n, type, verbose, force_multiprecision, force_mpfr
|
See |
tail |
|
direct_b, scale_iter, pf_method, adaptive, start_digits10, max_digits10, tol, use_arb
|
Numerical controls; see |
Runtime adaptive precision (adaptive=TRUE) requires an MPFR/GMP build. With the default DW_USE_MPFR=0 build, adaptive requests are downgraded to fixed Boost cpp_dec_float precision with a warning.
When type="arbitrary", rootWishartHD uses Boost cpp_dec_float by default. MPFR/GMP is optional and requires building with DW_USE_MPFR=1; rootWishartHD_mpfr_enabled() reports which backend was compiled.
Numeric vector of log probabilities in the same order as x.
doubleWishart_log(c(0.8, 0.9), s = 5, m = 10, n = 10, tail = "upper", verbose = FALSE)doubleWishart_log(c(0.8, 0.9), s = 5, m = 10, n = 10, tail = "upper", verbose = FALSE)
Computes upper-tail probabilities using log-survival when needed.
doubleWishart_pvalue(lambda_or_theta, s, m, n, input = c("auto", "theta", "lambda"), scale = c("p", "logp", "log10p"), backend = c("logexp", "robust"), type = "arbitrary", adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, fast_backend = c("scaled", "base"), verbose = FALSE)doubleWishart_pvalue(lambda_or_theta, s, m, n, input = c("auto", "theta", "lambda"), scale = c("p", "logp", "log10p"), backend = c("logexp", "robust"), type = "arbitrary", adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, fast_backend = c("scaled", "base"), verbose = FALSE)
lambda_or_theta |
Observed largest-root values. |
s, m, n
|
Jacobi parameters in Chiani's parameterization. |
input |
|
scale |
Return ordinary p-values, natural log p-values, or |
backend |
|
type, adaptive, start_digits10, max_digits10, tol
|
Precision controls. |
pass1_max_digits10 |
Digit cap for the first exact pass. Only unresolved points are refined. |
fast_try_double |
Try a fast double-precision CDF pass before exact log-tail evaluation. |
fast_backend |
|
verbose |
Logical. |
Numeric vector with status and method attributes.
Finds the largest-root critical value with .
doubleWishart_qalpha(alpha, s, m, n, return = c("theta", "lambda"), backend = c("logexp", "robust"), type = "arbitrary", adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, fast_backend = c("scaled", "base"), verbose = FALSE, max_iter = 120L)doubleWishart_qalpha(alpha, s, m, n, return = c("theta", "lambda"), backend = c("logexp", "robust"), type = "arbitrary", adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, fast_backend = c("scaled", "base"), verbose = FALSE, max_iter = 120L)
alpha |
Upper-tail probability in |
s, m, n
|
Jacobi parameters in Chiani's parameterization. |
return |
Return |
backend, type, adaptive, start_digits10, max_digits10, tol, pass1_max_digits10, fast_try_double, fast_backend, verbose
|
See |
max_iter |
Maximum number of bisection iterations. |
Numeric scalar with status and method attributes.
A robust log-scale dispatcher for large or difficult double-Wishart cases. It uses conservative Pfaffian settings and adaptive multiprecision by default.
doubleWishart_robustPfaffians(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), tail = c("lower", "upper"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, direct_b = FALSE, scale_iter = 8L, adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-30, use_arb = FALSE, p = NULL)doubleWishart_robustPfaffians(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), tail = c("lower", "upper"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, direct_b = FALSE, scale_iter = 8L, adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-30, use_arb = FALSE, p = NULL)
x |
Numeric vector on the Jacobi |
s, p, m, n, type, verbose, force_multiprecision, force_mpfr
|
See |
tail |
|
direct_b, scale_iter, adaptive, start_digits10, max_digits10, tol, use_arb
|
Numerical controls; see |
Numeric vector of log probabilities.
Computes a double-valued CDF using the scaled Pfaffian backend. This is the backend used by doubleWishart() for multiprecision or large s cases.
doubleWishart_scaled(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, direct_b = FALSE, scale_iter = 5L, pf_method = c("auto", "gauss", "svd", "schur", "lu"), adaptive = FALSE, start_digits10 = 200L, max_digits10 = 5000L, tol = 1e-30, use_arb = FALSE, p = NULL)doubleWishart_scaled(x, s = NULL, m, n, type = c("double", "arbitrary", "fixed"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, direct_b = FALSE, scale_iter = 5L, pf_method = c("auto", "gauss", "svd", "schur", "lu"), adaptive = FALSE, start_digits10 = 200L, max_digits10 = 5000L, tol = 1e-30, use_arb = FALSE, p = NULL)
x |
Numeric vector on the Jacobi |
s, p, m, n, type, verbose, force_multiprecision, force_mpfr
|
See |
direct_b |
Use the non-recursive construction for intermediate incomplete-beta terms. |
scale_iter |
Number of symmetric equilibration iterations before Pfaffian evaluation. |
pf_method |
Pfaffian backend. |
adaptive, start_digits10, max_digits10, tol
|
Adaptive multiprecision controls. |
use_arb |
Reserved for ARB-enabled local builds. |
Runtime adaptive precision (adaptive=TRUE) requires an MPFR/GMP build. With the default DW_USE_MPFR=0 build, adaptive requests are downgraded to fixed Boost cpp_dec_float precision with a warning.
For extreme upper tails, prefer doubleWishart_log(tail="upper"); any double-valued CDF may saturate to 1.
Numeric vector of CDF values.
doubleWishart_scaled(c(0.5, 0.8), s = 5, m = 10, n = 10, verbose = FALSE)doubleWishart_scaled(c(0.5, 0.8), s = 5, m = 10, n = 10, verbose = FALSE)
Reports whether the package was built with the optional MPFR/GMP backend.
rootWishartHD_mpfr_enabled()rootWishartHD_mpfr_enabled()
The default CRAN-safe build uses DW_USE_MPFR=0, which selects Boost's header-only cpp_dec_float backend from BH. To enable MPFR/GMP in a local source build, install MPFR and GMP and run, for example, DW_USE_MPFR=1 R CMD INSTALL rootWishartHD_*.tar.gz. This is optional; arbitrary precision still works with cpp_dec_float.
Logical scalar.
rootWishartHD_mpfr_enabled()rootWishartHD_mpfr_enabled()
Computes the CDF of the largest eigenvalue of a real single-Wishart matrix.
singleWishart_cdf(x, n_min, n_max, type = c("double", "arbitrary", "fixed"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, adaptive = FALSE, start_digits10 = 200L, max_digits10 = 5000L, tol = 1e-12)singleWishart_cdf(x, n_min, n_max, type = c("double", "arbitrary", "fixed"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, adaptive = FALSE, start_digits10 = 200L, max_digits10 = 5000L, tol = 1e-12)
x |
Numeric vector of nonnegative evaluation points on the eigenvalue scale. |
n_min, n_max
|
Positive integer single-Wishart dimensions with |
type, verbose, force_multiprecision, force_mpfr
|
See |
adaptive, start_digits10, max_digits10, tol
|
Adaptive multiprecision controls. |
Runtime adaptive precision (adaptive=TRUE) requires an MPFR/GMP build. With the default DW_USE_MPFR=0 build, adaptive requests are downgraded to fixed Boost cpp_dec_float precision with a warning.
Numeric vector of CDF values.
singleWishart_cdf(c(10, 20), n_min = 5, n_max = 10, verbose = FALSE)singleWishart_cdf(c(10, 20), n_min = 5, n_max = 10, verbose = FALSE)
Returns log-scale probabilities for the single-Wishart largest eigenvalue.
singleWishart_log(x, n_min, n_max, type = c("double", "arbitrary", "fixed"), tail = c("lower", "upper"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, adaptive = FALSE, start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12)singleWishart_log(x, n_min, n_max, type = c("double", "arbitrary", "fixed"), tail = c("lower", "upper"), verbose = TRUE, force_multiprecision = getOption("rootWishartHD.force_multiprecision", FALSE), force_mpfr = NULL, adaptive = FALSE, start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12)
x |
Numeric vector of nonnegative evaluation points on the eigenvalue scale. |
n_min, n_max
|
Positive integer single-Wishart dimensions with |
tail |
|
type, verbose, force_multiprecision, force_mpfr
|
See |
adaptive, start_digits10, max_digits10, tol
|
Adaptive multiprecision controls. |
Runtime adaptive precision (adaptive=TRUE) requires an MPFR/GMP build. With the default DW_USE_MPFR=0 build, adaptive requests are downgraded to fixed Boost cpp_dec_float precision with a warning.
Numeric vector of log probabilities.
singleWishart_log(c(20, 30), n_min = 5, n_max = 10, tail = "upper", verbose = FALSE)singleWishart_log(c(20, 30), n_min = 5, n_max = 10, tail = "upper", verbose = FALSE)
Computes for the single-Wishart largest eigenvalue.
singleWishart_pvalue(x, n_min, n_max, scale = c("p", "logp", "log10p"), backend = c("logexp"), adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, verbose = FALSE, sanity_check = TRUE, sanity_ratio = 1e6, sanity_min_cdf = 1e-12)singleWishart_pvalue(x, n_min, n_max, scale = c("p", "logp", "log10p"), backend = c("logexp"), adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, verbose = FALSE, sanity_check = TRUE, sanity_ratio = 1e6, sanity_min_cdf = 1e-12)
x |
Observed largest eigenvalue values on the single-Wishart scale. |
n_min, n_max
|
Positive integer single-Wishart dimensions. |
scale |
Return ordinary p-values, natural log p-values, or |
backend |
Currently |
adaptive, start_digits10, max_digits10, tol, pass1_max_digits10
|
Precision controls. |
fast_try_double |
Try |
verbose, sanity_check, sanity_ratio, sanity_min_cdf
|
Diagnostic and fast-path sanity controls. |
Numeric vector with status and method attributes.
Finds such that .
singleWishart_qalpha(alpha, n_min, n_max, return = c("x"), backend = c("logexp"), adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, verbose = FALSE, max_iter = 120L, max_expand = 200L)singleWishart_qalpha(alpha, n_min, n_max, return = c("x"), backend = c("logexp"), adaptive = rootWishartHD_mpfr_enabled(), start_digits10 = 300L, max_digits10 = 20000L, tol = 1e-12, pass1_max_digits10 = 3000L, fast_try_double = TRUE, verbose = FALSE, max_iter = 120L, max_expand = 200L)
alpha |
Upper-tail probability in |
n_min, n_max
|
Positive integer single-Wishart dimensions. |
return |
Only |
backend, adaptive, start_digits10, max_digits10, tol, pass1_max_digits10, fast_try_double, verbose
|
See |
max_iter, max_expand
|
Bisection and bracket-expansion controls. |
Numeric scalar with status and method attributes.