Skip to contents

This function calculates \(p\)-quantiles of a ddf distribution.

Usage

quantiles(dist, p, method = "all")

Arguments

dist

A ddf object, the distribution.

p

A number between 0 and 1, exclusive.

method

A character specifying the output format.

Value

A numeric vector.

Details

A \(p\)-quantile of a random variable \(X\) is a value \(x\) such that $$\mathbb{P}[ X \le x] \ge p \qquad\text{ and }\qquad \mathbb{P}[X \ge x] \ge 1-p,$$ where \(\mathbb{P}\) denotes the probability operator.

In general, it is not unique which is the reason for this function to have the method argument.

  • If method is set to "all", all values in the support which are a \(p\)- quantile of the given distribution are returned. This is the default behaviour.

  • If method is set to "mean", the mean of all such values is returned.

  • If method is set to "min" or "max", the respective elements of the \(p\)-quantiles in the support are returned.

See also

Other quantiles: decile(), percentile(), quartile()

Examples

quantiles(unif(6), 1 / 2)
#> [1] 3 4
# Using another method for output
quantiles(unif(6), 1 / 2, method = "mean")
#> [1] 3.5