NEWS  R Documentation 
DPQ News
Version 0.59 (20240823, svn r333)
NEW FEATURES

dbinom_raw()
gets a new more accurateversion = "R4.4"
, using the newpow1p()
function, from Rdevel, i.e., R 4.4.0 and newer. 
stirlerr_simpl()
gets argumentversion
, a string specifying the exact function to be used, currently with options("R3", "lgamma1p", "MM2", "n0")
. The first being the direct formula hardwired in R up to versions 4.3.z,"lgamma1p"
is to uselgamma1p(n)
instead oflgamma(n+1)
, whereas"MM2"
is a version usinglgamma(n)
and slightly more accurate forn \in [1, 5]
, approximately.stirlerr()
correspondingly gets argumentdirect.ver
to be passed tostirlerr_simpl(., version=*)
in the “direct” formula case, whenn < cutoffs[1]
. 
stirlerr()
gets argumentorder
allowing currently up to order 20 terms (constantsS0
..S19
) in Stirling's series (and not usingcutoffs
or direct formula). New
stirlerrC()
interfacing to C code which should “parallelize” R's own C levelstirlerr()
.More documentation and tests; experiments added in ‘../Misc/stirlerrtrms.R’; nice explorations to ‘../tests/stirlerrtst.R’
New functions
pow(x,y)
andpow_di(x,y)
computingx^y
as in R's C API ‘Rmathlib’.
dgamma.R(x, *)
gets new optional argument dpois_r_args. New function
expm1x()
providingexp(x)  1  x
numerically accurately also for smallx
.New function
pntGST23_T6()
implementing Gil et al.(2023)'s first asymptotic formula (Theorem 6).New experimental
Ixpq()
implementing Gil et al.(2023)'s direct incomplete Beta function, i.e.,pbeta()
version. TODO: make it work withmpfr()
!New function
pntGST23_T6()
andpntGST23_1()
implementing Gil et al.(2023)'s first asymptotic formula (Theorem 6), and based on Temme's Maple code for their direct computation (1).New function
pntVW13()
implementing Viktor Witkovský(2013)'s algorithm, from his published Matlab code.Data set
pt_Witkovsky_Tab1
containing (the free software subset of) Viktor Witkovský(2013)'s Table 1 ofpt(x, df=nu, ncp=delta)
examples; updated with octave results for both the original 2013 matlab code and the 2022 corrected one.
lgamma1p_series(x, k)
, the Taylor series approximations forlgamma1p(x)
:= \log \Gamma(1+x)
are now available up tok = 15
, also formpfr()
numbersx
. New
gam1d()
andgamln1()
providing more TOMS 708 auxiliary routines.
BUG FIXES

fix format fixes for when 'long != long long'.

dgamma.R(x, ..)
now does vectorize inx
, as documented. minor adjustment of
pntR()
's defaultuse.pnorm
.
‘src/bd0.c’ needed one more
PROTECT()
.
Misc
new ‘tests/dtex.R’ exploring
dt()
accuracy issues, mostly historical, but newly fordf=
\nu \ll 1
.
Version 0.58 (20231130, svn r278)
BUG FIXES

ebd0()
and C levelebd0C()
now work with long vectors and hence returndata.frame(yh = *, yl = *)
instead of 2row matrix. format fixes:
"%lld"
and(long long)
notably forR_xlen_t
.
Version 0.57 (20231020, svn r275)
Misc
fix "lost braces"
replace UTF8 greek glyps by plotmath
Version 0.56 (20230906, svn r272)
NEW FEATURES

phyperR()
getslower.tail=TRUE, log.p=FALSE
arguments.
BUG FIXES
Correctly vectorize
phyperR()
.
Misc
Documentation (and internal comment) updates for
qbinomR()
andqnbinomR()
, notably fixing "empty" argument doc.Deprecated
phyperBinMolenaar()
; it has been synonym tophyperBinMolenaar.1()
.Fix LaTeX warnings/errors by removing amazingly many
\cr
in ‘man/*.Rd’ files.
Version 0.55 (20230623, svn r264)
BUG FIXES

qbinomR(p, *)
,qnbinomR(p, *)
, andqpoisR(p, *)
: FixR_Q_P01_boundaries(p, ..)
for trivial boundaries, e.g.,p \in \{0,1\}
forlog.p=FALSE
.
Misc
A new
flang
Fortran compiler does not know outdatedderfc()
, but needs current standarderfc()
.
Version 0.54 (20230412, svn r261)
NEW FEATURES
New R function
qnormCappr()
.New R function
rexpm1()
from TOMS 708.Provide also
qnormR(*, version = "1.0.x")
and"1.0_noN"
, for history's sake.New R function
rlog1()
from TOMS 708.
BUG FIXES

qnormUappr()
&qnormUappr6()
were wrongly negative for lp in[.693147, 0)
(corresponding top > 1/2
).
Misc
Tweaks to the ‘qnormasymp’ vignette, related to the JSS submission.

‘tests/pqnorm_extreme.R’ plots more about the
pnormAsymp()
relative errors. Apple clang 14.0.3 needs looser tolerance for
logcf{R}()
anddbinom_raw()
comparisons.Minimally document the internal
.D_*()
and.DT_*()
utilities, as we provide them to experts and e.g., package DPQmpfr.
Version 0.53 (20221201, svn r240)
NEW FEATURES
New R functions
qntR()
andqtU()
,Vectorize()
d versions ofqntR1()
andqtU1()
, respectively.New
qtR() < Vectorize(qntR1, *)
; pure R implementation of R's Mathlib Clevelqt()
, but additionally allowing tweaks, used for fixing R's bug PR#18630. Added (optional) logscale Newton steps vialogNewton = log.p
, needing more tests.New
qtNappr()
– from the remark in R's ‘nmath/qt.c’ about very largedf
approximation, now with all 4 largedf terms from Abramowitz & Stegun's (26.7.5).New
gammaVer()
to exemplify R's (partly historical) versions ofgamma()
implementations.New
qnormUappr6()
, providing the ‘6 coefficients’approximation of A. & S. toqnorm()
.
qnormR()
gets newversion = "20220804"
which uses MM's newly derived asymptotic approximations toqnorm()
. New
qnormAsymp()
providing new asymptotic approximations toqnorm()
.Added vignette “Asymptotic Tail Formulas for Gaussian Quantiles”.
New
chebychevPoly()
(and auxiliaries) for evaluation of Chebyshev polynomials.
Version 0.52 (20220608, svn r212)
NEW FEATURES

qbetaAppr()
(and theqbetaAppr.{1,3}()
auxiliaries) now get alog.p
argument. all(?)
qbeta.Appr*()
functions now accept alower.tail
argument (with defaultTRUE
).New R function
dpsifn()
, as interface to R's C APIdpsifn()
, the workhorse of all R'spsigamma()
functions.
dpois_raw(x, lambda, *)
gets new cutoffsmall.x__lambda
to not usebd0()
orebd0()
whenx
is much smaller thanlambda
. Simple functions, mostly for didactical and comparison purposes,
dpois_simpl()
,dpois_simpl0()
andstirlerr_simpl()
, all of which use the “simple” direct formula which leads to numerical cancellation typically.New R function
bpser()
interfacing to the C function of the same in R's Mathlibpbeta()
orbratio()
in file ‘nmath/toms708.c’.
BUG FIXES
Updated URL of Abramowitz & Stegun.
Fixed
\
escape in one ‘man/*.Rd’
Misc
Our ‘tests/*.R’ no longer rely on the Matrix ‘testtools.R’ collection but rather use our own.
In ‘tests/chisqnoncex.R’ (and ‘DESCRIPTION’), we've replaced akima by interp as the latter has a FOSS licence.
Version 0.51 (20211210, svn r197)
NEW FEATURES

bd0(x, np, delta, ..)
now usesif (xnp <= delta * (x+np))
(lessequal instead of strictly less), and hence settingdelta = 0
is now allowed, using the series expansion only forx == np
, useful e.g., for the case of highly accurate mpfrnumbers.Similarly, in
log1pmx(x, .., eps2, ..)
,eps2 = 0
is now allowed.
BUG FIXES
consistency between
ebd0()
andebd0C()
: multiplication* e
coming last ("bug" did not show ..).
okLongDouble()
should no longer fail on M1 mac. 
ebd0C()
now checkingyl < 5.5
before returning; was horrendously wrong on Windows compiled withmnative
as long as it included (the default)mfma
(FMA:= FusedMultiplyAdd). fix
rchk
issue: "need"PROTECT(.)
while calling allocatinglgamma1p()
.
Version 0.50 (20210910, svn r183)
NEW FEATURES
new
ebd0C()
interface to C version; helps to fix lapsus in pure R versionebd0()
:ebd0(x, M)
for largeM
now checks for overflow inM/x
, and notably the casef * 2^(e+10) =: fg == Inf
.In
bd0()
work around underflow of(xnp)/(x+np)
.new R functions
frexp()
andldexp()
for getting and setting base2 representations of numbers, and new R functionmodf()
to split number into integer and fractional part, all interfacing the C99 (math lib) standard functions of the same name.
logcfR.(x)
has been “vectorized” inx
even though it's iterative with different number of iterations for eachx[i]
, and is hence considerably faster whenx
is an"mpfr"
vector.TODO: Consider renaming the two logcfR versions; at least neither is deprecated!
BUG FIXES
fixed embarrassing typo (two
i
's) bug inlogcfR()

stirlerr(n)
now also works whenis.integer(n)
andn
is large enough forn * n
to overflow (toNA
). fix typo/thinko in
dnbinomR()
ditto in
logcfR(*, trace=TRUE)
iteration report.
dpois_raw(x, *)
now works up to maximalx
, now preventing overflow in previous2*pi*x
computation. 
dnbinomR()
anddnbinom.mu()
fix forx > size
whenlog=TRUE
, notably forx >> size
.
Version 0.44 (20210522, svn r175)
NEW FEATURES
new
bd0_*()
versions ofbd0()
, based mainly onlog1pmx()
.
REFACTORING
To be more modular, our ‘testtools.R’ no longer
source()
those of Matrix.
BUG FIXES

‘src/bd0.c’ gave warning with some compiler settings with
Wselfassign
. 
‘testtools.R’
readRDS_()
thinko fixed.
Version 0.43 (20210505, svn r166)
NEW FEATURES
Provide R functions
log1mexpC()
,log1pexpC()
,log1pmxC()
, andlgamma1pC()
, all interfacing to R's C API (‘Rmath.h’), aka ‘Rmathlib’.New
pnormAsymp()
for asymptotic (typically upper tail, log scale) approximation ofpnorm()
. With Rmpfr, we can see how accurate these are in detail.New
dnbinomR()
finding better code for R itself,dnbinom.mu()
anddbinom_raw()
; also new utility functionsbd0()
andstirlerr()
, both vectorized, and also working with "mpfr"numbers, such thatdpois_raw()
now does so, too.Additionally, an “extended” version of
bd0()
calledebd0()
in pure R, where a C version was proposed by Morten Welinder in R's bugzilla, PR#15628.Experimentally, also provide
p1l1()
and its Taylor series approximationsp1l1ser()
which could be employed forbd0()
/ebd0()
instead of the current algorithms.Several C level utilities to be .Call()ed from R, from R's mathlib,
ldexp()
andfrexp()
even from C math.Pure R implementations (somewhat experimental) of corresponding R Mathlib C functions:
qbinomR()
,qnbinomR()
, andqpoisR()
each with several tuning parameters for the underlying algorithm, notably the rootfinding parts.newly,
logcf()
now based on C code, perfectly vectorizes; the pure R version, now calledlogcfR(x, *)
currently still runs the iterations simultaneously for all 'x[i]' and hence convergence and rescaling happen by “group decision”, efficiently but undesirable for strict comparisons.logcfR(x, *)
andlog1pmx(x, *)
now also work for "mpfr"numbersx
, andlog1pmx()
gets optionaleps2 = 1e2
andminL1 = 0.791
arguments, the defaults of which may change, as I think at least the latter to not be perfect.Now
lb_chiAsymp(nu, order)
works up to order 8.Provide the first parts of a new vignette (‘../vignettes/log1pmxetc.Rnw’) on
log1pmx()
,bd0()
, andstirlerr()
, which should contain part of Loader(2000)'s report and new findings of improvedbd0()
andstirlerr()
computations.
Version 0.42 (20201107, svn r151)
NEW FEATURES
New functions
pnormL*()
andpnormU*()
for (mathematically proven) lower and upper bound topnorm()
, notably also for investigation withlog.p=TRUE
.
qnormR()
, implementing current R'sqnorm()
in pure R, notably withtrace
andversion
options.
Version 0.41 (20200617, svn r145)
TESTING
Reorganize tests; notably to become less platform dependent.
Version 0.40 (20200615, svn r137)
NEW FEATURES
Many new
phyper*()
functions and helpers for them, such as Bernoulli numbersBern()
and asymptoticlgammaAsymp()
.Notably
phyperR2()
which is a pure R version of R's own (C code based)phyper()
.
Version 0.35 (20191018, svn r131)
NEW FEATURES

pnbetaAS310()
gained auseAS226
option. New
okLongDouble()
function, notably for detecting that with avalgrind
ed version of R,long double
C arithmetic seems to silently switch to (simple)double
precision.
BUG FIXES
long double printing from C now should happen correctly on all platforms including 32 and 64bit Windows.
Version 0.34 (20191016, svn r125)
NEW FEATURES
more efficient (internally vectorized)
dntJKBf()
. Consequently,dntJKBf1()
is deprecated now.
pntR()
(andpntR1()
) get new optionuse.pnorm
(the default of which had been hard coded previously).
BUG FIXES
fix thinko in
any_mpfr()
andall_mpfr()
.
pnchisqRC()
's C code gave severe valgrind warnings; fixed printing oflong double
etc; also added special MinGW deal in Windows. 
ppoisD()
behaves differently in a valgrinded version; for now, reproducible only when using valgrind on nonvalgrinded installed package.
Version 0.33 (20190924, svn r110)
NEW FEATURES
Renamed (and generalized / merged) many functions to have less "." in names.
New
pnbetaAS310()
function interfacing to my corrected C version of 'ASA 310' (2007).New
algdiv()
function interfacing to the 'TOMS 708' version of ourlogQab()
.New
pl2curves()
which generalizes (somewhat) previous functionp.dnchiB()
.Made
newton()
more flexible with newxMin
andxMax
arguments which are notably useful forq*()
(quantile function) computations.Correspondingly replaced previous
qchisq2()
andqchisqA()
with newqchisqN()
(‘N’ewton).new
pnchisqRC()
, a version of R's C level noncentral chisquared, with additional options.
“new”
logspace.add()
andlogspace.sub()
. 
“new”
pnchisqT93()
(plus its two auxiliaries), implementing Temme(1993)'s approximations. 
“new”
pnchisqBolKuz()
andqnchisqBolKuz()
implementing Bol'shev and Kuznetzov (1963)'s approximations. 
“new”
pnchi1sq()
andpnchi2sq()
with “exact” formulas for the special casesdf=1
anddf=3
. simplified formula in
dtWV()
.
BUG FIXES

qnchisqPearson(pp, df=DF, ncp=100)
andqnchisqSankaran_d(*)
no longer returnNaN
for very largeDF = 1e200
. 
pnchisq()
now also has defaultverbose = 0
as all other such functions withverbose
(ortrace[.lev]
optional argument.
Version 0.30 [20180828]
NEW FEATURES
Move many of my up to 15 years old DPQ computation utilities into a package, to become public, “bloggable”, etc.