| farebro | R Documentation |
Calculates the cumulative probability distribution function and the probability density function of a weighted sum of noncentral chi-squared variables.
farebro(lambda, mult = 1, delta = 0, x, ...,
maxit = 1e+06, eps = 1e-06, warn = TRUE)
lambda |
Numeric vector of positive weights. |
mult |
Integer value or integer vector of multiplicities (degrees of freedom). |
delta |
Numeric value or numeric vector of noncentrality parameters. |
x |
Numeric value or vector giving the function argument (quantiles for which the cumulative probability and density are desired). |
... |
Ignored. |
maxit |
Integer. Maximum number of iterations. |
eps |
Positive numeric value. Maximum error in the probability value. |
warn |
Logical value specifying whether to issue a warning if an error code is returned. |
This function implements the algorithm of
Farebrother (1984) for computing the cumulative distribution
function F(x) = P(X \le x)
and probability density function f(x) = F^\prime(x)
of the random variable
Y = \sum_{j=1}^n \lambda_j X_j
where X_1,\ldots,X_n are independent
random variables and X_j has a noncentral
\chi^2 distribution with m_j degrees of
freedom and noncentrality parameter \delta_j.
The arguments lambda, mult and delta
should be vectors of equal length, or will be recycled so that
they have equal length.
The algorithm uses an exact mathematical representation of F(x)
as an infinite series, and a mathematical upper bound on the error
of the truncated series, to compute an approximation to F(x)
which is guaranteed to be accurate to within the specified error
eps. The algorithm involves calculating the probability density
f(x) as well. It returns the values of both F(x) and
f(x).
An error code ifault is returned for each entry of x.
Nonzero error codes are translated to text warnings if
warn=TRUE.
A data frame, with one row for each entry in x,
and columns x (input value),
p (cumulative probability),
d (probability density)
and ifault (error code).
R.W. Farebrother, adapted by \adrian. Original Algol code of Farebrother (1984) translated to C by Adrian Baddeley and modified to handle a vector of quantile values. R interface by Adrian Baddeley.
Farebrother, R.W. (1984)
Algorithm AS 204:
The distribution of a positive linear combination of \chi^2
random variables. Applied Statistics 33 (3) 332–339.
dsocs
## Farebrother (1984) Table 1, example Q_5 (rows 13-15)
farebro(c(7,3), c(6,2), c(6,2), c(20, 100, 200))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.