pRQF {skedastic} | R Documentation |
Probabilities for a Ratio of Quadratic Forms in a Normal Random Vector
Description
This function computes cumulative probabilities (lower or upper tail) on a ratio of quadratic forms in a vector of normally distributed random variables.
Usage
pRQF(
r,
A,
B,
Sigma = diag(nrow(A)),
algorithm = c("imhof", "davies", "integrate"),
lower.tail = TRUE,
usenames = FALSE
)
Arguments
r |
A double representing the value(s) for which |
A |
A numeric, symmetric matrix that is symmetric |
B |
A numeric, symmetric, non-negative definite matrix having the same
dimensions as |
Sigma |
A numeric, symmetric matrix with the same dimensions as
|
algorithm |
A character, either |
lower.tail |
A logical. If |
usenames |
A logical. If |
Details
Most of the work is done by other functions, namely
imhof
, davies
,
or integrate
(depending on the algorithm
argument). It is assumed that the ratio of quadratic forms can be
expressed as
R = \displaystyle\frac{x' A x}{x' B x}
where x
is an
n
-dimensional normally distributed random variable with mean vector
\mu
and covariance matrix \Sigma
, and A
and
B
are real-valued, symmetric n\times n
matrices. Matrix
B
must be non-negative definite to ensure that the denominator of
the ratio of quadratic forms is nonzero.
The function makes use of the fact that a probability statement involving a
ratio of quadratic forms can be rewritten as a probability statement
involving a quadratic form. Hence, methods for computing probabilities
for a quadratic form in normal random variables, such as the Imhof
algorithm (Imhof 1961) or the Davies algorithm
(Davies 1980) can be applied to the rearranged
expression to obtain the probability for the ratio of quadratic forms.
Note that the Ruben-Farebrother algorithm (as implemented in
farebrother
) cannot be used here because the
A
matrix within the quadratic form (after rearrangement of the
probability statement involving a ratio of quadratic forms) is not in
general positive semi-definite.
Value
A double denoting the probability/ies corresponding to the value(s)
r
.
References
Davies RB (1980).
“Algorithm AS 155: The Distribution of a Linear Combination of \chi^2
Random Variables.”
Journal of the Royal Statistical Society. Series C (Applied Statistics), 29, 323–333.
Imhof JP (1961).
“Computing the Distribution of Quadratic Forms in Normal Variables.”
Biometrika, 48(3/4), 419–426.
See Also
Duchesne and de Micheaux (2010), the article associated
with the imhof
and
davies
functions.
Examples
n <- 20
A <- matrix(data = 1, nrow = n, ncol = n)
B <- diag(n)
pRQF(r = 1, A = A, B = B)
pRQF(r = 1, A = A, B = B, algorithm = "integrate")
pRQF(r = 1:3, A = A, B = B, algorithm = "davies")