| qden | R Documentation |
estimate the quantile density function using either a direct estimation approach with a bandwidth selected by the quantile optimality ratio (QOR), or by the density method which uses the inverse of the estimated density at the nominated quantiles
qden(
x,
u,
dist = "gl",
method = "qor",
kernel = "epanechnikov",
params = NULL,
gl.control = list(method = "Lmom"),
quantile.type = 8,
bw.correct = TRUE,
large.n.switch = TRUE,
...
)
x |
a numeric vector of data values. |
u |
a numeric vector of probability values in the interval |
dist |
a character string naming a distribution or a quantile function name. Supported built-in distributions include |
method |
the estimation method to use. The options are |
kernel |
the kernel to use when |
params |
a list of parameter values. If |
gl.control |
a list of control arguments passed to |
quantile.type |
argument for the quantile function used when |
bw.correct |
logical; if |
large.n.switch |
logical; if |
... |
additional arguments to be passed to |
This function estimates the quantile density function at a vector of probability values u. Two estimation methods are available.
If method = "qor", a bandwidth is selected using the quantile optimality ratio (QOR) and a kernel-based estimator is used.
The bandwidth depends on the selected kernel through its variance and roughness constants. Supported kernels are "epanechnikov",
"gaussian", "rectangular", "triangular", "biweight", "cosine", and "optcosine". By default, the QOR
method uses the flexible four parameter Generalized Lambda Distribution (GLD) to compute the QOR. The method of L-moments is used for
GLD parameter estimation, although other estimators can be chosen by passing arguments through the gl.control argument to the fit.fkml function from the
gld package which is used for estimation. Other included distributions for computing the QOR are the lognormal dist = "lnorm", Gaussian dist = "norm",
and exponential "exp". If another character string is passed to dist, then the function will attempt to locate
the associated quantile function and so dist needs to follow R's naming convention of prefixing
the distribution name with q. E.g., dist = "beta" will use the associated quantile function for the beta distribution, qbeta. The parameter values to be used
for this distribution can be specified using the list argument params. If params is NULL, the function
will attempt to use default choices for these parameters.
If method = "density", the quantile density is estimated as the reciprocal of a density estimate evaluated at the estimated quantiles.
When params is NULL, the density estimate is obtained directly from density. When params is supplied, the corresponding quantile and density functions from argument dist are used.
E.g., if dist = "beta", then the quantile density will be computed using the qbeta and dbeta functions.
a vector of estimated quantile density values at u.
Prendergast, L. A., Dedduwakumara, D.S. & Staudte, R.G. (2024). rquest: An R package for hypothesis tests and confidence intervals for quantiles and summary measures based on quantiles. Preprint, pages 1–13.
qor for quantile optimality ratio values,
qcov for covariance estimation of sample quantiles, and qrcov for covariance estimation of ratios of linear combinations of quantiles.
set.seed(1234)
x <- rnorm(100)
# QOR-based quantile density estimation using the flexible GLD distribution (default method)
qden(x, c(0.25, 0.5, 0.75), method = "qor")
# QOR-based quantile density estimation using the normal distribution
qden(x, c(0.25, 0.5, 0.75), dist = "norm", method = "qor")
# Density-based quantile density estimation
qden(x, c(0.25, 0.5, 0.75), method = "density")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.