q_mixdist: Quantile Function of a Mixture Model

q.mixdistR Documentation

Quantile Function of a Mixture Model

Description

q.mixdist is a method that evaluates the quantile function of a mixture distribution object at given values.

Usage

## S3 method for class 'mixdist'
q(O, p, lower.tail = TRUE, log.p = FALSE, ...)

Arguments

O

mixture distribution object.

p

vector of probabilities.

lower.tail

logical; if TRUE, probabilities are P[X ≤ x] otherwise, P[X > x], default: TRUE.

log.p

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

...

further arguments to be passed.

Details

Methods of q function evaluates any offered distribution from the package mistr. The function makes use of the p[sufix] and q[sufix] functions as pnorm or qbeta and thus, if a new distribution is 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 values 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 q and the default method q.default have its own help page.

Value

Vector of computed results.

See Also

set_opt

Examples

DM <- mixdist(3*binomdist(12, 0.4), -2*poisdist(2)+12, weights=c(0.5, 0.5))
y <- c(0.4, p(DM, c(5, 10, 15, 18)), 0.95)
x <- q(DM, y)
plot(DM, which = "cdf", only_mix=TRUE, xlim1 = c(0, 37))
points(x, y)

mistr documentation built on March 7, 2023, 7:42 p.m.