dnt | R Documentation |
dntJKBm
is a fully Rmpfr-ified vectorized version of
dntJKBf()
from DPQ; see there.
dtWVm(x, df, ncp)
computes the density function f(x)
of the t distribution with
df
degrees of freedom and non-centrality parameter ncp
,
according to Wolfgang Viechtbauer's proposal in 2002, using an asymptotic
formula for “large” df
= \nu
.
dntJKBm(x, df, ncp, log = FALSE, M = 1000) # __ Deprecated __ use DPQ :: dntJKBf
dtWVm (x, df, ncp, log = FALSE)
x |
numeric or |
df |
degrees of freedom ( |
ncp |
non-centrality parameter |
log |
as in |
M |
the number of terms to be used, a positive integer. |
See dtWV
's details (package DPQ).
As DPQ's dntJKBf()
is already fully
mpfr-ized, dntJKBm()
is deprecated.
an mpfr
vector of the same length as the maximum
of the lengths of x, df, ncp
.
Package DPQ's dntJKBf()
is already fully
mpfr-ized, and hence dntJKBm()
is redundant, and therefore deprecated.
Martin Maechler
R's dt
, and package DPQ's
dntJKBf()
and dtWV()
.
tt <- seq(0, 10, len = 21)
ncp <- seq(0, 6, len = 31)
dt3R <- outer(tt, ncp, dt , df = 3)
dt3WV <- outer(tt, ncp, dtWVm, df = 3)
all.equal(dt3R, dt3WV) # rel.err 0.00063
dt25R <- outer(tt, ncp, dt , df = 25)
dt25WV <- outer(tt, ncp, dtWVm, df = 25)
all.equal(dt25R, dt25WV) # rel.err 1.1e-5
x <- -10:700
fx <- dt (x, df = 22, ncp =100)
lfx <- dt (x, df = 22, ncp =100, log=TRUE)
lfV <- dtWVm(x, df = 22, ncp =100, log=TRUE)
head(lfx, 15) # shows that R's dt(*, log=TRUE) implementation is "quite suboptimal"
## graphics
opa <- par(no.readonly=TRUE)
par(mar=.1+c(5,4,4,3), mgp = c(2, .8,0))
plot(fx ~ x, type="l")
par(new=TRUE) ; cc <- c("red", adjustcolor("orange", 0.4))
plot(lfx ~ x, type = "o", pch=".", col=cc[1], cex=2, ann=FALSE, yaxt="n")
sfsmisc::eaxis(4, col=cc[1], col.axis=cc[1], small.args = list(col=cc[1]))
lines(x, lfV, col=cc[2], lwd=3)
dtt1 <- " dt"; dtt2 <- "(x, df=22, ncp=100"; dttL <- paste0(dtt2,", log=TRUE)")
legend("right", c(paste0(dtt1,dtt2,")"), paste0(c(dtt1,"dtWVm"), dttL)),
lty=1, lwd=c(1,1,3), col=c("black", cc), bty = "n")
par(opa) # reset
## For dntJKBm(), see example(dntJKBf, package="DPQ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.