prodchisqpow {sadists}R Documentation

The product of (non-central) chi-squares raised to powers distribution.

Description

Density, distribution function, quantile function and random generation for the distribution of the product of non-central chi-squares taken to powers.

Usage

dprodchisqpow(x, df, ncp=0, pow=1, log = FALSE, order.max=5)

pprodchisqpow(q, df, ncp=0, pow=1, lower.tail = TRUE, log.p = FALSE, order.max=5)

qprodchisqpow(p, df, ncp=0, pow=1, lower.tail = TRUE, log.p = FALSE, order.max=5)

rprodchisqpow(n, df, ncp=0, pow=1)

Arguments

x, q

vector of quantiles.

df

the vector of degrees of freedom. This is recycled against the ncp, pow, but not against the x,q,p,n.

ncp

the vector of non-centrality parameters. This is recycled against the df, pow, but not against the x,q,p,n.

pow

the vector of the power parameters. This is recycled against the df, ncp, but not against the x,q,p,n.

log

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

order.max

the order to use in the approximate density, distribution, and quantile computations, via the Gram-Charlier, Edeworth, or Cornish-Fisher expansion.

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

Let X_i \sim \chi^2\left(\delta_i, \nu_i\right) be independently distributed non-central chi-squares, where \nu_i are the degrees of freedom, and \delta_i are the non-centrality parameters. Let p_i be given constants. Suppose

Y = \prod_i X_i^{p_i}.

Then Y follows a product of chi-squares to power distribution.

Value

dprodchisqpow gives the density, pprodchisqpow gives the distribution function, qprodchisqpow gives the quantile function, and rprodchisqpow 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.

The PDQ functions are computed by translation of the sum of log chi-squares distribution functions.

Author(s)

Steven E. Pav shabbychef@gmail.com

References

Pav, Steven. Moments of the log non-central chi-square distribution. https://arxiv.org/abs/1503.06266

See Also

The sum of log of chi-squares distribution, dsumlogchisq, psumlogchisq, qsumlogchisq, rsumlogchisq, The upsilon distribution, dupsilon, pupsilon, qupsilon, rupsilon. The sum of chi-square powers distribution, dsumchisqpow, psumchisqpow, qsumchisqpow, rsumchisqpow.

Examples

df <- c(100,20,10)
ncp <- c(5,3,1)
pow <- c(1,0.5,1)
rvs <- rprodchisqpow(128, df, ncp, pow)
dvs <- dprodchisqpow(rvs, df, ncp, pow)
qvs <- pprodchisqpow(rvs, df, ncp, pow)
pvs <- qprodchisqpow(ppoints(length(rvs)), df, ncp, pow)

[Package sadists version 0.2.5 Index]