dkprime: The K prime distribution.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/kprime.r

Description

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

Usage

1
2
3
4
5
6
7
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 log(f).

p

vector of probabilities.

n

number of observations.

log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

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

Details

Suppose y ~ x^2(v1), and x ~ t(v2,(a/b) sqrt(y/v1)). Then the random variable

T = b x

takes a K prime distribution with parameters v1, v2, a, b. In Lecoutre's terminology, T ~ K'_v1,v2(a,b)

Equivalently, we can think of

T = (bZ + a sqrt(chi2_v1/v1)) / sqrt(chi2_v2/v2)

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 v1=inf we recover a rescaled non-central t distribution; when b=0, we get a rescaled square root of a central F distribution; when v2=inf, 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 [email protected]

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. http://arxiv.org/abs/1003.4890v1

See Also

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

Examples

1
2
3
4
5
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)

shabbychef/sadists documentation built on May 26, 2017, 6:59 a.m.