pnt {DPQ} | R Documentation |
Non-central t Probability Distribution - Algorithms and Approximations
Description
Compute different approximations for the non-central t-Distribution cumulative probability distribution function.
Usage
pntR (t, df, ncp, lower.tail = TRUE, log.p = FALSE,
use.pnorm = (df > 4e5 ||
ncp^2 > 2*log(2)*(-.Machine$double.min.exp)),
itrmax = 1000, errmax = 1e-12, verbose = TRUE)
pntR1 (t, df, ncp, lower.tail = TRUE, log.p = FALSE,
use.pnorm = (df > 4e5 ||
ncp^2 > 2*log(2)*(-.Machine$double.min.exp)),
itrmax = 1000, errmax = 1e-12, verbose = TRUE)
pntP94 (t, df, ncp, lower.tail = TRUE, log.p = FALSE,
itrmax = 1000, errmax = 1e-12, verbose = TRUE)
pntP94.1 (t, df, ncp, lower.tail = TRUE, log.p = FALSE,
itrmax = 1000, errmax = 1e-12, verbose = TRUE)
pnt3150 (t, df, ncp, lower.tail = TRUE, log.p = FALSE, M = 1000, verbose = TRUE)
pnt3150.1 (t, df, ncp, lower.tail = TRUE, log.p = FALSE, M = 1000, verbose = TRUE)
pntLrg (t, df, ncp, lower.tail = TRUE, log.p = FALSE)
pntJW39 (t, df, ncp, lower.tail = TRUE, log.p = FALSE)
pntJW39.0 (t, df, ncp, lower.tail = TRUE, log.p = FALSE)
Arguments
t |
vector of quantiles (called |
df |
degrees of freedom ( |
ncp |
non-centrality parameter |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are
|
use.pnorm |
The default corresponds to R |
itrmax |
number of iterations / terms. |
errmax |
convergence bound for the iterations. |
verbose |
|
M |
positive integer specifying the number of terms to use in the series. |
Details
pntR1()
:a pure R version of the (C level) code of R's own
pt()
, additionally giving more flexibility (via argumentsuse.pnorm
,itrmax
,errmax
whose defaults here have been hard-coded in R's C code).This implements an improved version of the AS 243 algorithm from Lenth(1989);
- R's help on non-central
pt()
says: -
This computes the lower tail only, so the upper tail suffers from cancellation and a warning will be given when this is likely to be significant.
- and (in ‘Note:’)
The code for non-zero
ncp
is principally intended to be used for moderate values ofncp
: it will not be highly accurate, especially in the tails, for large values.
- R's help on non-central
pntR()
:the
Vectorize()
d version ofpntR1()
.pntP94()
,pntP94.1()
:New versions of
pntR1()
,pntR()
; using the Posten (1994) algorithm.pntP94()
is theVectorize()
d version ofpntP94.1()
.pnt3150()
,pnt3150.1()
:-
Simple inefficient but hopefully correct version of pntP94..() This is really a direct implementation of formula (31.50), p.532 of Johnson, Kotz and Balakrishnan (1995)
pntLrg()
:provides the
pnorm()
approximation (to the non-centralt
) from Abramowitz and Stegun (26.7.10), p.949; which should be employed only for largedf
and/orncp
.pntJW39.0()
:use the Jennett & Welch (1939) approximation see Johnson et al. (1995), p. 520, after (31.26a). This is still fast for huge
ncp
but has wrong asymptotic tail for|t| \to \infty
. Crucially needsb=
b_chi(df)
.pntJW39()
:is an improved version of
pntJW39.0()
, using1-b =
b_chi(df, one.minus=TRUE)
to avoid cancellation when computing1 - b^2
.
Value
a number for pntJKBf1()
and .pntJKBch1()
.
a numeric vector of the same length as the maximum of the lengths of
x, df, ncp
for pntJKBf()
and .pntJKBch()
.
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
Lenth, R. V. (1989). Algorithm AS 243 —
Cumulative distribution function of the non-central t
distribution,
JRSS C (Applied Statistics) 38, 185–189.
Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions. New York: Dover; formula (26.7.10), p.949
See Also
pt
, for R's version of non-central t probabilities.
Examples
tt <- seq(0, 10, len = 21)
ncp <- seq(0, 6, len = 31)
dt3R <- outer(tt, ncp, pt, , df = 3)
dt3JKB <- outer(tt, ncp, pntR, df = 3)# currently verbose
stopifnot(all.equal(dt3R, dt3JKB, tolerance = 4e-15))# 64-bit Lnx: 2.78e-16