QF {QF} | R Documentation |
Positive Definite Quadratic Forms Distribution
Description
Density function, distribution function, quantile function and random generator for positive definite QFs.
Usage
dQF(x, obj)
pQF(q, obj)
qQF(p, obj, eps_quant = 1e-06, maxit_quant = 10000)
rQF(n, lambdas, etas = rep(0, length(lambdas)))
Arguments
x , q |
vector of quantiles. |
obj |
|
p |
vector of probabilities. |
eps_quant |
relative error for quantiles. |
maxit_quant |
maximum number of Newton-Raphson iterations allowed to compute quantiles. |
n |
number of observations. |
lambdas |
vector of positive weights. |
etas |
vector of non-centrality parameters. Default all zeros. |
Details
The quadratic form CDF and PDF are evaluated by numerical inversion of the Mellin transform.
The absolute error specified in compute_MellinQF
is guaranteed for values of q
and x
inside the range_q
.
If the quantile is outside range_q
, computations are carried out, but a warning is sent.
The function uses the Newton-Raphson algorithm to compute the QF quantiles related to probabilities p
.
Value
dQF
provides the values of the density function at a quantile x
.
pQF
provides the cumulative distribution function at a quantile q
.
qQF
provides the quantile corresponding to a probability level p
.
rQF
provides a sample of n
independent realizations from the QF.
See Also
See compute_MellinQF
for details on the Mellin computation.
Examples
library(QF)
# Definition of the QF
lambdas_QF <- c(rep(7, 6),rep(3, 2))
etas_QF <- c(rep(6, 6), rep(2, 2))
# Computation Mellin transform
eps <- 1e-7
rho <- 0.999
Mellin <- compute_MellinQF(lambdas_QF, etas_QF, eps = eps, rho = rho)
xs <- seq(Mellin$range_q[1], Mellin$range_q[2], l = 100)
# PDF
ds <- dQF(xs, Mellin)
plot(xs, ds, type="l")
# CDF
ps <- pQF(xs, Mellin)
plot(xs, ps, type="l")
# Quantile
qs <- qQF(ps, Mellin)
plot(ps, qs, type="l")
#Comparison computed quantiles vs real quantiles
plot((qs - xs) / xs, type = "l")