sumchisqpow {sadists}R Documentation

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

Description

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

Usage

dsumchisqpow(x, wts, df, ncp=0, pow=1, log = FALSE, order.max=6)

psumchisqpow(q, wts, df, ncp=0, pow=1, lower.tail = TRUE, log.p = FALSE, order.max=6)

qsumchisqpow(p, wts, df, ncp=0, pow=1, lower.tail = TRUE, log.p = FALSE, order.max=6)

rsumchisqpow(n, wts, df, ncp=0, pow=1)

Arguments

x, q

vector of quantiles.

wts

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

df

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

ncp

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

pow

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

log

logical; if TRUE, densities ff are given as \mboxlog(f)\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 \mboxlog(p)\mbox{log}(p).

lower.tail

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

Details

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

Y=iwiXipi.Y = \sum_i w_i X_i^{p_i}.

Then YY follows a weighted sum of chi-squares to power distribution.

Value

dsumchisqpow gives the density, psumchisqpow gives the distribution function, qsumchisqpow gives the quantile function, and rsumchisqpow 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 'sum of chisquare power' distribution does not generalize the 'chi-bar-square' distribution, whose density is the sum of chi-square densities.

Author(s)

Steven E. Pav shabbychef@gmail.com

See Also

The upsilon distribution, dupsilon,pupsilon,qupsilon,rupsilon.

Examples

wts <- c(1,-3,4)
df <- c(100,20,10)
ncp <- c(5,3,1)
pow <- c(1,0.5,1)
rvs <- rsumchisqpow(128, wts, df, ncp, pow)
dvs <- dsumchisqpow(rvs, wts, df, ncp, pow)
qvs <- psumchisqpow(rvs, wts, df, ncp, pow)
pvs <- qsumchisqpow(ppoints(length(rvs)), wts, df, ncp, pow)

[Package sadists version 0.2.5 Index]