Quantile - Maple Help

Student[Statistics]

 Quantile
 compute quantiles
 Quartile
 compute quartiles
 Percentile
 compute percentiles
 Decile
 compute deciles

 Calling Sequence Quantile(A, qn, numeric_option, output_option) Quantile(M, qn, numeric_option, output_option) Quantile(X, qn, numeric_option, output_option) Quartile(A, qr, numeric_option, output_option) Quartile(M, qr, numeric_option, output_option) Quartile(X, qr, numeric_option, output_option) Decile(A, d, numeric_option, output_option) Decile(M, d, numeric_option, output_option) Decile(X, d, numeric_option, output_option) Percentile(A, p, numeric_option, output_option) Percentile(M, p, numeric_option, output_option) Percentile(X, p, numeric_option, output_option)

Parameters

 A - M - X - algebraic; random variable qn - algebraic; probability expressed as a number between 0 and 1 (inclusive) qr - algebraic; probability expressed as a number between 0 and 4 (inclusive) d - algebraic; probability expressed as a number between 0 and 10 (inclusive) p - algebraic; probability expressed as a percentage numeric_option - (optional) equation of the form numeric=value where value is true or false output_option - (optional) equation of the form output=x where x is value, plot, or both

Description

 • The Quantile function computes the quantile corresponding to the given probability p for the specified random variable or data sample.
 • The $p$th quantile of a data sample or random variable is the same as the $4p$th quartile, the $10p$th decile, and the $100p$th percentile.
 • For a real valued random variable X with distribution function $F\left(x\right)$, and any $p$ between 0 and 1, the $p$th quantile of $X$ is defined as $\mathrm{inf}\left\{y|F\left(y\right)\ge p\right\}$. For continuous random variables this is equivalent to the inverse distribution function.
 • The first parameter can be a data sample (e.g., a Vector), a Matrix data sample, a random variable, or an algebraic expression involving random variables (see Student[Statistics][RandomVariable]).
 • The second parameter p is the probability, which has to be between 0 and 1 (inclusive) for Quantile, between 0 and 4 (inclusive) for Quartile, between 0 and 10 (inclusive) for Decile, and between 0 and 100 (inclusive) for Percentile.
 • The number we are looking for is the $j$th item in the sorted data sample, where $j=⌊n\mathrm{qn}+1⌋$. This is the same as using method=1 in Statistics[ Quantile].

Computation

 • By default, all computations involving random variables are performed symbolically (see option numeric below).
 • If the selected quantile, quartile, decile, or percentile is a floating point value, then the floating point value is returned. Otherwise, the value is returned as is.
 • By default, the quantile, quartile, decile, percentile are computed according to the rules mentioned above. To always compute the quantile numerically, specify the numeric or numeric = true option.

Examples

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{Statistics}\right]\right):$

Compute a quantile of the normal distribution.

 > $\mathrm{Quantile}\left(\mathrm{NormalRandomVariable}\left(4,9\right),\frac{1}{2}\right)$
 ${4}$ (1)

Use numeric parameters.

 > $\mathrm{Quantile}\left(\mathrm{NormalRandomVariable}\left(4,9\right),0.5\right)$
 ${4.}$ (2)
 > $\mathrm{Quantile}\left(\mathrm{NormalRandomVariable}\left(4,9\right),\frac{1}{2},\mathrm{numeric}\right)$
 ${4.}$ (3)

Use the output=plot option.

 > $\mathrm{Quantile}\left(\mathrm{NormalRandomVariable}\left(4,9\right),\frac{1}{3},\mathrm{output}=\mathrm{plot}\right)$

Create two normal random variables and compute the quantiles of their sum.

 > $X≔\mathrm{NormalRandomVariable}\left(5,2\right):$
 > $Y≔\mathrm{NormalRandomVariable}\left(2,5\right):$
 > $\mathrm{Quantile}\left(X+Y,\frac{1}{3}\right)$
 $\frac{\left({7}{}\sqrt{{58}}{+}{58}{}{\mathrm{RootOf}}{}\left({3}{}{\mathrm{erf}}{}\left({\mathrm{_Z}}\right){+}{1}\right)\right){}\sqrt{{58}}}{{58}}$ (4)
 > $\mathrm{Quantile}\left(X+Y,\frac{1}{3},\mathrm{numeric}\right)$
 ${4.68046250585916}$ (5)

Compute the quantile of a data sample.

 > $\mathrm{Quantile}\left(\left[1,2,45,4,2,0.9,2,4,7,276,1,-1\right],0.92\right)$
 ${276}$ (6)

Consider the following Matrix data sample.

 > $M≔\mathrm{Matrix}\left(\left[\left[3,16.0,\mathrm{\pi }\right],\left[4.0,17,18\right],\left[\frac{19}{6},\mathrm{sqrt}\left(5\right),464\right],\left[2,88,-8\right],\left[4,5,0\right]\right]\right)$
 $\left[\begin{array}{ccc}3& 16.0& \mathrm{π}\\ 4.0& 17& 18\\ \frac{19}{6}& \sqrt{5}& 464\\ 2& 88& -8\\ 4& 5& 0\end{array}\right]$ (7)

We compute the $\frac{3}{7}$ quantile of each of the columns.

 > $\mathrm{Quantile}\left(M,\frac{3}{7}\right)$
 $\left[\begin{array}{ccc}\frac{19}{6}& 16.0& \mathrm{π}\end{array}\right]$ (8)

The $p$th quantile of a data sample or random variable is the same as the $4p$th quartile, the $10p$th decile, and the $100p$th percentile.

 > $\mathrm{Quartile}\left(M,\frac{12}{7}\right)$
 $\left[\begin{array}{ccc}\frac{19}{6}& 16.0& \mathrm{π}\end{array}\right]$ (9)
 > $\mathrm{Decile}\left(M,\frac{30}{7}\right)$
 $\left[\begin{array}{ccc}\frac{19}{6}& 16.0& \mathrm{π}\end{array}\right]$ (10)
 > $\mathrm{Percentile}\left(M,\frac{300}{7}\right)$
 $\left[\begin{array}{ccc}\frac{19}{6}& 16.0& \mathrm{π}\end{array}\right]$ (11)

Use the output=both option.

 > $\mathrm{quantile},\mathrm{graph}≔\mathrm{Quantile}\left(M,\frac{3}{7},\mathrm{output}=\mathrm{both}\right)$
 ${\mathrm{quantile}}{,}{\mathrm{graph}}{≔}\left[\begin{array}{ccc}\frac{{19}}{{6}}& {16.}& {\mathrm{\pi }}\end{array}\right]{,}{}$ (12)
 > $\mathrm{quantile}$
 $\left[\begin{array}{ccc}\frac{19}{6}& 16.0& \mathrm{π}\end{array}\right]$ (13)
 > $\mathrm{graph}$

 > 

References

 Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.
 Hyndman, R.J., and Fan, Y. "Sample Quantiles in Statistical Packages." American Statistician, Vol. 50. (1996): 361-365.

Compatibility

 • The Student[Statistics][Quantile] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.