kprime | R Documentation |
Density, distribution function, quantile function and random generation for the K prime distribution.
dkprime(x, v1, v2, a, b = 1, order.max=6, log = FALSE)
pkprime(q, v1, v2, a, b = 1, order.max=6, lower.tail = TRUE, log.p = FALSE)
qkprime(p, v1, v2, a, b = 1, order.max=6, lower.tail = TRUE, log.p = FALSE)
rkprime(n, v1, v2, a, b = 1)
x, q |
vector of quantiles. |
v1 |
the degrees of freedom in the numerator chisquare. When
(positive) infinite, we recover a non-central t
distribution with |
v2 |
the degrees of freedom in the denominator chisquare.
When equal to infinity, we recover the Lambda prime distribution.
This is not recycled against the |
a |
the non-centrality scaling parameter. When equal to zero,
we recover the (central) t distribution.
This is not recycled against the |
b |
the scaling parameter.
This is not recycled against the |
order.max |
the order to use in the approximate density, distribution, and quantile computations, via the Gram-Charlier, Edeworth, or Cornish-Fisher expansion. |
log |
logical; if TRUE, densities |
p |
vector of probabilities. |
n |
number of observations. |
log.p |
logical; if TRUE, probabilities p are given
as |
lower.tail |
logical; if TRUE (default), probabilities are
|
Suppose y \sim \chi^2\left(\nu_1\right)
, and
x \sim t \left(\nu_2, a\sqrt{y/\nu_1}/b\right)
.
Then the random variable
T = b x
takes a K prime distribution with parameters
\nu_1, \nu_2, a, b
. In Lecoutre's terminology,
T \sim K'_{\nu_1, \nu_2}\left(a, b\right)
Equivalently, we can think of
T = \frac{b Z + a \sqrt{\chi^2_{\nu_1} / \nu_1}}{\sqrt{\chi^2_{\nu_2} / \nu_2}}
where Z
is a standard normal, and the normal and the (central) chi-squares are
independent of each other. When a=0
we recover
a central t distribution;
when \nu_1=\infty
we recover a rescaled non-central t distribution;
when b=0
, we get a rescaled square root of a central F
distribution; when \nu_2=\infty
, we recover a
Lambda prime distribution.
dkprime
gives the density, pkprime
gives the
distribution function, qkprime
gives the quantile function,
and rkprime
generates random deviates.
Invalid arguments will result in return value NaN
with a warning.
The PDF, CDF, and quantile function are approximated, via the Edgeworth or Cornish Fisher approximations, which may not be terribly accurate in the tails of the distribution. You are warned.
The distribution parameters are not recycled
with respect to the x, p, q
or n
parameters,
for, respectively, the density, distribution, quantile
and generation functions. This is for simplicity of
implementation and performance. It is, however, in contrast
to the usual R idiom for dpqr functions.
Steven E. Pav shabbychef@gmail.com
Lecoutre, Bruno. "Two Useful distributions for Bayesian predictive procedures under normal models." Journal of Statistical Planning and Inference 79, no. 1 (1999): 93-105.
Poitevineau, Jacques, and Lecoutre, Bruno. "Implementing Bayesian predictive procedures: The K-prime and K-square distributions." Computational Statistics and Data Analysis 54, no. 3 (2010): 724-731. https://arxiv.org/abs/1003.4890v1
t distribution functions, dt, pt, qt, rt
,
lambda prime distribution functions, dlambdap, plambdap, qlambdap, rlambdap
.
d1 <- dkprime(1, 50, 20, a=0.01)
d2 <- dkprime(1, 50, 20, a=0.0001)
d3 <- dkprime(1, 50, 20, a=0)
d4 <- dkprime(1, 10000, 20, a=1)
d5 <- dkprime(1, Inf, 20, a=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.