pRQF: Probabilities for a Ratio of Quadratic Forms in a Normal...

View source: R/pRQF.R

pRQFR 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≤ r) or \Pr(R ≥ 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 ≤ r) is computed; if FALSE, the survival function \Pr(R ≥ 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 μ and covariance matrix Σ, 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 \insertCiteImhof61skedastic or the Davies algorithm \insertCiteDavies80skedastic 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

\insertAllCited

See Also

\insertCite

Duchesne10;textualskedastic, 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")


skedastic documentation built on Nov. 10, 2022, 5:43 p.m.