dnt {DPQmpfr} | R Documentation |
Non-central t-Distribution Density
Description
dntJKBm
is a fully Rmpfr-ified vectorized version of
dntJKBf()
from DPQ which implements the
summation formulas of Johnson, Kotz and Balakrishnan (1995),
(31.15) on page 516 and (31.15') on p.519, the latter being typo-corrected
for a missing factor 1 / j!
.
Usage
dntJKBm(x, df, ncp, log = FALSE, M = 1000)
Arguments
x , df , ncp |
|
log |
as in |
M |
the number of terms to be used, a positive integer. |
Details
How to choose M
optimally has not been investigated yet and
is probably also a function of the precision of the first three arguments (see
getPrec
from Rmpfr).
Value
an mpfr
vector of the same length as the maximum
of the lengths of x, df, ncp
.
Author(s)
Martin Maechler
References
Johnson, N.L., Kotz, S. and Balakrishnan, N. (1995)
Continuous Univariate Distributions Vol~2, 2nd ed.; Wiley.
Chapter 31, Section 5 Distribution Function, p.514 ff
See Also
dt
.
Examples
require(Rmpfr)
## [not too large, as dntJKBm() is currently somewhat slow]
(mt <- mpfr(tt <- seq(0, 9, by = 1 ), 128))
(mcp <- mpfr(ncp <- seq(0, 5, by = 1/2), 128))
dt3R <- outer(tt, ncp, dt, df = 3)
dt3M <- outer(mt, mcp, dntJKBm, df = 3, M = 128)# for speed
all.equal(dt3R, dt3M) # TRUE, and show difference
all.equal(dt3R, dt3M, tol=0) # 1.2e-12