dkprime: The K prime distribution.

View source: R/kprime.r

kprimeR Documentation

The K prime distribution.

Description

Density, distribution function, quantile function and random generation for the K prime distribution.

Usage

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)

Arguments

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 degrees of freedom and non-centrality parameter a, scaled by b. This is not recycled against the x,q,p,n.

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 x,q,p,n.

a

the non-centrality scaling parameter. When equal to zero, we recover the (central) t distribution. This is not recycled against the x,q,p,n.

b

the scaling parameter. This is not recycled against the x,q,p,n.

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 f are given as \mbox{log}(f).

p

vector of probabilities.

n

number of observations.

log.p

logical; if TRUE, probabilities p are given as \mbox{log}(p).

lower.tail

logical; if TRUE (default), probabilities are P[X \le x], otherwise, P[X > x].

Details

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.

Value

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.

Note

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.

Author(s)

Steven E. Pav shabbychef@gmail.com

References

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

See Also

t distribution functions, dt, pt, qt, rt, lambda prime distribution functions, dlambdap, plambdap, qlambdap, rlambdap.

Examples

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)


sadists documentation built on Aug. 22, 2023, 1:06 a.m.