Learn R Programming

mistr (version 0.0.6)

qlim.discrmixdist: Right-Hand Limit of Mixture Quantile Function

Description

qlim.mixdist is a method that evaluates the right-hand limit of quantile function for a mixture distribution object at given values.

Usage

# S3 method for discrmixdist
qlim(O, p, lower.tail = TRUE, log.p = FALSE)

# S3 method for contdiscrmixdist qlim(O, p, lower.tail = TRUE, log.p = FALSE)

# S3 method for contmixdist qlim(O, p, lower.tail = TRUE, log.p = FALSE)

Value

Vector of computed results.

Arguments

O

mixture distribution object.

p

vector of probabilities.

lower.tail

logical; if TRUE, probabilities are \(P[X \le x]\) otherwise, \(P[X > x]\), default: TRUE.

log.p

logical; if TRUE, probabilities \(p\) are given as \(log(p)\), default: FALSE.

Details

Methods of qlim function evaluates the right-hand limit of a quantile function for any offered distribution object from the package mistr. The right-hand limit of a quantile function is defined as $$Q(x+)=inf{x: p<P(X\le x)}.$$ The function makes use of the p[sufix] and q[sufix] functions as pnorm, pbeta, qnorm, qbeta, and thus, if a new distribution will be added, these functions must be reachable through the search path.

The values are numerically found using the uniroot function, while the starting intervals are found automatically. The option parameter tol specifies the tolerance for the uniroot. Options parameter sub is used to test whether the CDF at computed value minus sub is not the same and thus the given value is not an infimum. In such case, the root is found one more time for the value p - sub.

Other methods qlim have its own help page.

See Also

set_opt

Examples

Run this code
# q() of a negative transformed random variable uses qlim()
DM <- mixdist(3*binomdist(12,0.4), -2*poisdist(2)+12, weights=c(0.5, 0.5))
y <- c(0.05, 0.4, p(-DM, c(-5, -10, -15, -18)), 0.95)
x <- q(-DM, y)
plot(-DM, which = "cdf", only_mix=TRUE, xlim1 = c(-37, 0))
points(x, y)

Run the code above in your browser using DataLab