The function computes the Mellin transform of the ratio of independent and positive definite quadratic forms producing a MellinQF_ratio
object.
The output can be used to evaluate the density, cumulative and quantile functions of the target quadratic form.
compute_MellinQF_ratio(
lambdas_num,
lambdas_den,
etas_num = rep(0, length(lambdas_num)),
etas_den = rep(0, length(lambdas_den)),
eps = 1e-06,
rho = 1 - 1e-04,
maxit_comp = 1e+05,
eps_quant = 1e-06,
maxit_quant = 10000,
lambdas_tol = NULL
)
The function returns an object of the class MellinQF_ratio
that contains information on the Mellin transform
of the ratio of two linear combinations of positively weighted chi-square random variables. This information can be used in order to
evaluate the density, cumulative distribution and quantile functions of the desired quadratic form.
An object of the class MellinQF_ratio
has the following components:
range_q
: the range of quantiles that contains the specified mass of probability rho
in which it
is possible to compute density and CDF preserving the error level eps
.
Mellin
: a list containing the values of the Mellin transform (Mellin
),
the corresponding evaluation points (z
), the integration step delta
and the lowest numerator weight (lambda_min
).
the inputs rho
, lambdas_num
, lambdas_den
, etas_num
, etas_den
, eps
needed for CDF, PDF and quantile function computation.
vector of positive weights for the numerator.
vector of positive weights for the denominator.
vector of non-centrality parameters for the numerator. Default all zeros (central chi square).
vector of non-centrality parameters for the denominator. Default all zeros (central chi square).
required absolute error for density and cumulative functions.
distribution total probability mass for which it is desired to keep the error eps
.
maximum number of iterations.
required numerical error for quantile computation.
maximum number of iterations before stopping the quantile computation.
maximum value admitted for the weight skewness for both the numerator and the denominator. When it is not NULL (default), elements of lambdas such that the ratio max(lambdas)/lambdas is greater than the specified value are removed.
The Mellin transform of the ratio of two independent quadratic forms having positive weights lambdas_num
and lambdas_den
and non-centrality parameters etas_num
and etas_den
is computed
exploiting the density formulation by Ruben (1962). The numerical error is controlled in order to provide the requested precision (eps
) for the
interval of quantiles that contains the specified total probability rho
.
The argument eps_quant
controls the relative precision requested for the computation of quantiles that determine the range in which the error eps
is
guaranteed, whereas maxit_quant
sets the maximum number of Newton-Raphson iterations of the algorithm.
The function print.MellinQF_ratio
can be used to summarize the basic information on the Mellin transform.
The object can be used in the function dQF_ratio
to compute the density function of the QFs ratio,
pQF_ratio
for the CDF and qQF_ratio
for the quantile function.
# \donttest{
library(QF)
# Definition of the QFs
lambdas_QF_num <- c(rep(7, 6),rep(3, 2))
etas_QF_num <- c(rep(6, 6), rep(2, 2))
lambdas_QF_den <- c(0.6, 0.3, 0.1)
# Computation Mellin transform
eps <- 1e-7
rho <- 0.999
Mellin_ratio <- compute_MellinQF_ratio(lambdas_QF_num, lambdas_QF_den,
etas_QF_num, eps = eps, rho = rho)
print(Mellin_ratio)
# }
Run the code above in your browser using DataLab