Learn R Programming

lmomco (version 2.4.14)

par2qua2: Equivalent Quantile Function of Two Distributions

Description

This function computes the nonexceedance probability of a given quantile from a linear weighted combination of two quantile functions---a mixed distribution: $$Q_\mathrm{mixed}(F; \Theta_1, \Theta_2, \omega) = (1-\omega)Q_1(F, \Theta_1) + \omega Q_2(F, \Theta2)\mbox{,}$$ where \(Q\) is a quantile function for nonexceedance probability \(F\), the distributions have parameters \(\Theta_1\) and \(\Theta_2\), and \(\omega\) is a weight factor.

The distributions are specified by the two parameter object arguments in usual lmomco style. When proration by the nonexceedance probability is desired (weight=NULL, default), the left-tail parameter object (para1) is the distribution obviously governing the left tail; the right-tail parameter object (para2) is of course governs the right tail. The quantile function algebra is $$ Q(F) = (1-F^\star) \times {\triangleleft}Q(F) + F^\star \times Q(F){\triangleright}\mbox{,}$$ where \(Q(F)\) is the mixed quantile for nonexceedance probability \(F\). \({\triangleleft}Q(F)\) is the first or left-tail quantile function; \(Q(F){\triangleright}\) is the second or right-tail quantile function. In otherwords, if weight = NULL, then \(F^\star = F =\) f and the weight between the two quantile functions thus continuously varies from left to right. This is a probability proration from one to the other. A word of caution in this regard. The resulting weighted- or mixed-quantile function is not rigorously checked for monotonic increase with \(F\), which is a required property of quantile functions. However, a first-order difference on the mixed quantiles with the probabilities is computed and a warning issued if not monotonic increasing.

If the optional weight argument is provided with length 1, then \(\omega\) equals that weight. If weight = 0, then only the quantiles for \(Q_1(F)\) are returned, and if weight = 1, then only the quantiles for the left tail \(Q_2(F)\) are returned.

If the optional weight argument is provided with length 2, then \((1 - \omega)\) is replaced by the first weight and \(\omega\) is replaced by the second weight. These are internally rescaled to sum to unity before use and a warning is issued that this was done. Finally, the par2cdf2 function inverses the above equation for \(F\).

Usage

par2qua2(f, para1, para2, wfunc=NULL, weight=NULL, as.list=FALSE, ...)

Value

The weighted quantile value for \(F\) from the two distributions.

Arguments

f

Nonexceedance probability (\(0 \le F \le 1\)).

para1

The first or left-tail parameters from lmom2par or vec2par.

para2

The second or right-tail parameters from lmom2par or similar.

wfunc

A function taking the argument f and computing a weight for the para2 curve for which the complement of the computed weight is used for the weight on para1.

weight

An optional weighting argument to use in lieu of F. If NULL then prorated by the f, if weight has length 1, then weight on left distribution is the complement of the weight and weight on right distribution is weight[1], and if weight had length 2, then weight[1] is the weight on the left distribution and weight[2] is the weight on the right distribution.

as.list

A logical to control whether an R data.frame is returned having a column for f and for the mixed quantiles. This feature is provided for some design consistency with par2qua2lo, which mandates a data.frame return.

...

The additional arguments are passed to the quantile function.

Author

W.H. Asquith

See Also

par2qua, par2cdf2, par2qua2lo

Examples

Run this code
lmr <- lmoms(rnorm(20)); left <- parnor(lmr); right <- pargev(lmr)
mixed.median <- par2qua2(0.5, left, right)

# Bigger example--using Kappa fit to whole sample for the right tail and
# Normal fit to whole sample for the left tail
D   <- c(123, 523, 345, 356, 2134, 345, 2365, 235, 12, 235, 61, 432, 843)
lmr <- lmoms(D); KAP <- parkap(lmr); NOR <- parnor(lmr); PP <- pp(D)
plot( PP, sort(D), ylim=c(-500, 2300))
lines(PP, par2qua( PP, KAP),      col=2)
lines(PP, par2qua( PP, NOR),      col=3)
lines(PP, par2qua2(PP, NOR, KAP), col=4)

Run the code above in your browser using DataLab