DPQ-package {DPQ} | R Documentation |
Density, Probability, Quantile ('DPQ') Computations
Description
Computations for approximations and alternatives for the 'DPQ' (Density (pdf), Probability (cdf) and Quantile) functions for probability distributions in R. Primary focus is on (central and non-central) beta, gamma and related distributions such as the chi-squared, F, and t. – For several distribution functions, provide functions implementing formulas from Johnson, Kotz, and Kemp (1992) <doi:10.1002/bimj.4710360207> and Johnson, Kotz, and Balakrishnan (1995) for discrete or continuous distributions respectively. This is for the use of researchers in these numerical approximation implementations, notably for my own use in order to improve standard R pbeta(), qgamma(), ..., etc: {'"dpq"'-functions}.
Details
The DESCRIPTION file:
Package: | DPQ |
Title: | Density, Probability, Quantile ('DPQ') Computations |
Version: | 0.5-8 |
Date: | 2023-11-30 |
VersionNote: | Last CRAN: 0.5-7 on 2023-11-03 |
Authors@R: | c(person("Martin","Maechler", role=c("aut","cre"), email="maechler@stat.math.ethz.ch", comment = c(ORCID = "0000-0002-8685-9910")) , person("Morten", "Welinder", role = "ctb", comment = "pgamma C code, see PR#7307, Jan. 2005; further pdhyper()") , person("Wolfgang", "Viechtbauer", role = "ctb", comment = "dtWV(), 2002") , person("Ross", "Ihaka", role = "ctb", comment = "src/qchisq_appr.c") , person("Marius", "Hofert", role = "ctb", comment = "lsum(), lssum()") , person("R-core", email = "R-core@R-project.org", role = "ctb", comment = "src/{dpq.h, algdiv.c, pnchisq.c, bd0.c}") , person("R Foundation", role = "cph", comment = "src/qchisq-appr.c") ) |
Description: | Computations for approximations and alternatives for the 'DPQ' (Density (pdf), Probability (cdf) and Quantile) functions for probability distributions in R. Primary focus is on (central and non-central) beta, gamma and related distributions such as the chi-squared, F, and t. -- For several distribution functions, provide functions implementing formulas from Johnson, Kotz, and Kemp (1992) <doi:10.1002/bimj.4710360207> and Johnson, Kotz, and Balakrishnan (1995) for discrete or continuous distributions respectively. This is for the use of researchers in these numerical approximation implementations, notably for my own use in order to improve standard R pbeta(), qgamma(), ..., etc: {'"dpq"'-functions}. |
Depends: | R (>= 4.0.0) |
Imports: | stats, graphics, methods, utils, sfsmisc (>= 1.1-14) |
Suggests: | Rmpfr, DPQmpfr (>= 0.3-1), gmp, MASS, mgcv, scatterplot3d, interp |
SuggestsNote: | MASS::fractions() in ex | mgcv, scatt.., interp: some tests/ |
License: | GPL (>= 2) |
Encoding: | UTF-8 |
URL: | https://specfun.r-forge.r-project.org/, https://r-forge.r-project.org/R/?group_id=611, https://r-forge.r-project.org/scm/viewvc.php/pkg/DPQ/?root=specfun, svn://svn.r-forge.r-project.org/svnroot/specfun/pkg/DPQ |
BugReports: | https://r-forge.r-project.org/tracker/?atid=2462&group_id=611 |
Author: | Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Morten Welinder [ctb] (pgamma C code, see PR#7307, Jan. 2005; further pdhyper()), Wolfgang Viechtbauer [ctb] (dtWV(), 2002), Ross Ihaka [ctb] (src/qchisq_appr.c), Marius Hofert [ctb] (lsum(), lssum()), R-core [ctb] (src/{dpq.h, algdiv.c, pnchisq.c, bd0.c}), R Foundation [cph] (src/qchisq-appr.c) |
Maintainer: | Martin Maechler <maechler@stat.math.ethz.ch> |
Index of help topics:
.D_0 Distribution Utilities "dpq" Bern Bernoulli Numbers DPQ-package Density, Probability, Quantile ('DPQ') Computations M_LN2 Numerical Utilities - Functions, Constants algdiv Compute log(gamma(b)/gamma(a+b)) when b >= 8 b_chi Compute E[chi_nu]/sqrt(nu) useful for t- and chi-Distributions bd0 Utility Functions for 'dgamma()' - Pure R Versions bpser 'pbeta()' 'bpser' series computation chebyshevPoly Chebyshev Polynomial Evaluation dbinom_raw R's C Mathlib (Rmath) dbinom_raw() Binomial Probability pure R Function dgamma.R Gamma Density Function Alternatives dhyperBinMolenaar HyperGeometric (Point) Probabilities via Molenaar's Binomial Approximation dnbinomR Pure R Versions of R's C (Mathlib) dnbinom() Negative Binomial Probabilities dnchisqR Approximations of the (Noncentral) Chi-Squared Density dntJKBf1 Non-central t-Distribution Density - Algorithms and Approximations dpsifn Psi Gamma Functions Workhorse from R's API dtWV Noncentral t Distribution Density by Viechtbauer format01prec Format Numbers in [0,1] with "Precise" Result frexp Base-2 Representation and Multiplication of Numbers gammaVer Gamma Function Versions hyper2binomP Transform Hypergeometric Distribution Parameters to Binomial Probability lbetaM (Log) Beta Approximations lfastchoose R versions of Simple Formulas for Logarithmic Binomial Coefficients lgamma1p Accurate 'log(gamma(a+1))' lgammaAsymp Asymptotic Log Gamma Function log1mexp Compute log(1 - exp(-a)) and log(1 + exp(x)) Numerically Optimally log1pmx Accurate 'log(1+x) - x' Computation logcf Continued Fraction Approximation of Log-Related Power Series logspace.add Logspace Arithmetix - Addition and Subtraction lssum Compute Logarithm of a Sum with Signed Large Summands lsum Properly Compute the Logarithm of a Sum (of Exponentials) newton Simple R level Newton Algorithm, Mostly for Didactical Reasons p1l1 Numerically Stable p1l1(t) = (t+1)*log(1+t) - t pbetaRv1 Pure R Implementation of Old pbeta() pchisqV Wienergerm Approximations to (Non-Central) Chi-squared Probabilities phyper1molenaar Molenaar's Normal Approximations to the Hypergeometric Distribution phyperAllBin Compute Hypergeometric Probabilities via Binomial Approximations phyperApprAS152 Normal Approximation to cumulative Hyperbolic Distribution - AS 152 phyperBin.1 HyperGeometric Distribution via Approximate Binomial Distribution phyperBinMolenaar HyperGeometric Distribution via Molenaar's Binomial Approximation phyperIbeta Pearson's incomplete Beta Approximation to the Hyperbolic Distribution phyperPeizer Peizer's Normal Approximation to the Cumulative Hyperbolic phyperR R-only version of R's original phyper() algorithm phyperR2 Pure R version of R's C level phyper() phypers The Four (4) Symmetric 'phyper()' Calls pl2curves Plot 2 Noncentral Distribution Curves for Visual Comparison pnbetaAppr2 Noncentral Beta Probabilities pnchi1sq (Probabilities of Non-Central Chi-squared Distribution for Special Cases pnchisq (Approximate) Probabilities of Non-Central Chi-squared Distribution pnormAsymp Asymptotic Approxmation of (Extreme Tail) 'pnorm()' pnormL_LD10 Bounds for 1-Phi(.) - Mill's Ratio related Bounds for pnorm() pntR Non-central t Probability Distribution - Algorithms and Approximations ppoisErr Direct Computation of 'ppois()' Poisson Distribution Probabilities qbetaAppr Compute (Approximate) Quantiles of the Beta Distribution qbinomR Pure R Implementation of R's qbinom() with Tuning Parameters qchisqAppr Compute Approximate Quantiles of the Chi-Squared Distribution qgammaAppr Compute (Approximate) Quantiles of the Gamma Distribution qnbinomR Pure R Implementation of R's qnbinom() with Tuning Parameters qnchisqAppr Compute Approximate Quantiles of Noncentral Chi-Squared Distribution qnormAppr Approximations to 'qnorm()', i.e., z_alpha qnormAsymp Asymptotic Approximation to Outer Tail of qnorm() qnormR Pure R version of R's 'qnorm()' with Diagnostics and Tuning Parameters qntR Pure R Implementation of R's qt() / qnt() qpoisR Pure R Implementation of R's qpois() with Tuning Parameters qtAppr Compute Approximate Quantiles of the (Non-Central) t-Distribution qtR Pure R Implementation of R's C-level t-Distribution Quantiles 'qt()' qtU 'uniroot()'-based Computing of t-Distribution Quantiles r_pois Compute Relative Size of i-th term of Poisson Distribution Series rexpm1 TOMS 708 Approximation REXP(x) of expm1(x) = exp(x) - 1
Further information is available in the following vignettes:
Noncentral-Chisq | Noncentral Chi-Squared Probabilities -- Algorithms in R (source) |
comp-beta | Computing Beta(a,b) for Large Arguments (source) |
log1pmx-etc | log1pmx, bd0, stirlerr - Probability Computations in R (source) |
qnorm-asymp | Asymptotic Tail Formulas For Gaussian Quantiles (source) |
An important goal is to investigate diverse algorithms and approximations
of R's own density (d*()
), probability (p*()
), and
quantile (q*()
) functions, notably in “border” cases where
the traditional published algorithms have shown to be suboptimal, not
quite accurate, or even useless.
Examples are border cases of the beta distribution, or non-central distributions such as the non-central chi-squared and t-distributions.
Author(s)
Principal author and maintainer: Martin Maechler <maechler@stat.math.ethz.ch>
See Also
The package DPQmpfr, which builds on this package and on Rmpfr.
Examples
## Show problem in R's non-central t-distrib. density (and approximations):
example(dntJKBf)