This function computes cumulative probabilities (lower or upper tail) on a
ratio of quadratic forms in a vector of normally distributed
random variables. 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.
pRQF(
r,
A,
B,
Sigma = diag(nrow(A)),
algorithm = c("imhof", "davies", "integrate"),
lower.tail = TRUE,
usenames = FALSE
)
A double representing the value(s) for which \(\Pr(R\le r)\) or \(\Pr(R \ge r)\) should be computed.
A numeric, symmetric matrix that is symmetric
A numeric, symmetric, non-negative definite matrix having the same
dimensions as A
.
A numeric, symmetric matrix with the same dimensions as
A
and B
, denoting the covariance matrix of the normal
random vector. Defaults to the identity matrix, corresponding to the case
in which the normal random variables are independent and identically
distributed.
A character, either "imhof"
, "davies"
, or
"integrate"
. Values "imhof"
and "integrate"
both implement the Imhof algorithm. The difference is that "imhof"
means that imhof
is used, whereas
"integrate"
means that integrate
is
used (which is slower). The Imhof algorithm is more precise than the
Davies algorithm.
A logical. If TRUE
, the cumulative distribution
function \(\Pr(R \le r)\) is computed; if FALSE
, the survival
function \(\Pr(R \ge r)\) is computed.
A logical. If TRUE
, the function value has a
names
attribute corresponding to r
.
A double denoting the probability/ies corresponding to the value(s)
r
.
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 Imhof61skedastic or the Davies algorithm
Davies80skedastic 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.
Duchesne10;textualskedastic, the article associated
with the imhof
and
davies
functions.
# NOT RUN {
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")
# }
Run the code above in your browser using DataLab