Expand description
Rmath — Statistical distribution functions and special math functions.
Implements the R C API mathematical functions declared in Rmath.h.
These are extern "C" functions resolved by package .so files at load time.
Core special functions:
- Regularized incomplete gamma function (lower P and upper Q)
- Regularized incomplete beta function
- Polygamma functions (digamma, trigamma, etc.)
Distribution functions follow R’s convention:
d*(x, params..., give_log)— density (PDF), optionally logp*(x, params..., lower_tail, log_p)— distribution (CDF)q*(p, params..., lower_tail, log_p)— quantile (inverse CDF)r*(params...)— random variate
Constants§
Functions§
- Rf_
bessel_ i - Rf_
bessel_ i_ ex - Rf_
bessel_ j - Rf_
bessel_ j_ ex - Rf_
bessel_ k - Rf_
bessel_ k_ ex - Rf_
bessel_ y - Rf_
bessel_ y_ ex - Rf_
dbeta - Rf_
dbinom - Rf_
dcauchy - Rf_
dchisq - Rf_dexp
- Rf_df
- Rf_
dgamma - Rf_
dgeom - Rf_
dhyper - Rf_
dlnorm - Rf_
dlogis - Rf_
dnbeta - Rf_
dnbinom - Rf_
dnbinom_ mu - Rf_
dnchisq - Rf_dnf
- Rf_
dnorm4 - Rf_dnt
- Rf_
dpois - Rf_
dsignrank - Rf_dt
- Rf_
dunif - Rf_
dweibull - Rf_
dwilcox - Rf_
hypot - Rf_
pbeta - Rf_
pbinom - Rf_
pcauchy - Rf_
pchisq - Rf_pexp
- Rf_pf
- Rf_
pgamma - Rf_
pgeom - Rf_
phyper - Rf_
plnorm - Rf_
plogis - Rf_
pnbeta - Rf_
pnbinom - Rf_
pnbinom_ mu - Rf_
pnchisq - Rf_pnf
- Rf_
pnorm5 - Rf_
pnorm_ both - Rf_pnt
- Rf_
ppois - Rf_
psignrank - Rf_pt
- Rf_
ptukey - Rf_
punif - Rf_
pweibull - Rf_
pwilcox - Rf_
qbeta - Rf_
qbinom - Rf_
qcauchy - Rf_
qchisq - Rf_qexp
- Rf_qf
- Rf_
qgamma - Rf_
qgeom - Rf_
qhyper - Rf_
qlnorm - Rf_
qlogis - Rf_
qnbeta - Rf_
qnbinom - Rf_
qnbinom_ mu - Rf_
qnchisq - Rf_qnf
- Rf_
qnorm5 - Rf_qnt
- Rf_
qpois - Rf_
qsignrank - Rf_qt
- Rf_
qtukey - Rf_
qunif - Rf_
qweibull - Rf_
qwilcox - Rf_
rbeta - Rf_
rbinom - Rf_
rcauchy - Rf_
rchisq - Rf_rexp
- Rf_rf
- Rf_
rgamma - Rf_
rgeom - Rf_
rhyper - Rf_
rlnorm - Rf_
rlogis - Rf_
rnbinom - Rf_
rnchisq - Rf_
rnorm - Rf_
rpois - Rf_
rsignrank - Rf_rt
- Rf_
runif - Rf_
rweibull - Rf_
rwilcox - bessel_
i_ 🔒series - bessel_
j_ 🔒series - bessel_
k0 🔒 - bessel_
k1 🔒 - bessel_
k_ 🔒int - beta_
cf_ 🔒term - Terms for the continued fraction expansion of the incomplete beta function.
- beta_fn
- Beta function B(a,b) = Γ(a)Γ(b)/Γ(a+b).
- choose_
fn - Binomial coefficient choose(n, k).
- d_log 🔒
- Apply give_log to a density value.
- digamma_
fn - Digamma function ψ(x) = d/dx ln Γ(x).
- gamma_
cf 🔒 - Continued fraction for the upper incomplete gamma function.
- gamma_
series 🔒 - Series expansion for the regularized incomplete gamma function.
- lbeta_
fn - Log-beta function ln B(a,b).
- lchoose_
fn - Log of binomial coefficient.
- lgamma1p_
fn - lgamma(1+a) for small a, using series expansion.
- log1pmx_
fn - log(1+x) - x, accurate for small x.
- logspace_
add_ fn - log(exp(lx) + exp(ly)), computed in log-space for numerical stability.
- logspace_
sub_ fn - log(exp(lx) - exp(ly)), computed in log-space. Requires lx >= ly.
- p_
transform 🔒 - Apply lower_tail and log_p transforms to a CDF value.
- pbeta_
raw - Regularized incomplete beta function I_x(a, b). Uses continued fraction (Lentz’s method).
- pentagamma
- Pentagamma function ψ₃(x).
- pgamma_
raw - Regularized lower incomplete gamma function P(a, x) = γ(a,x) / Γ(a). Uses series expansion for x < a+1, continued fraction otherwise.
- psigamma_
fn - Psigamma: the m-th derivative of the digamma function.
- q_
decode 🔒 - Decode p from log_p / lower_tail for quantile functions.
- qgamma_
raw - Regularized upper incomplete gamma function Q(a, x) = 1 - P(a, x).
- qnorm_
standard 🔒 - Standard normal quantile function (inverse Φ).
- r_
finite 🔒 - rmultinom
- tetragamma
- Tetragamma function ψ₂(x).
- trigamma
- Trigamma function ψ₁(x) = d²/dx² ln Γ(x).
- unif_
rand 🔒 - Call the thread-local RNG from runtime.rs