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 \Pr(R\le r) or \Pr(R \ge r) should be computed.

A

A numeric, symmetric matrix that is symmetric

B

A numeric, symmetric, non-negative definite matrix having the same dimensions as A.

Sigma

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.

algorithm

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.

lower.tail

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.

usenames

A logical. If TRUE, the function value has a names attribute corresponding to r.

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")


[Package skedastic version 2.0.2 Index]