Quantile
Quantile[list,q]
gives the q quantile of list.
Quantile[list,{q1,q2,…}]
gives a list of quantiles q1, q2, ….
Quantile[list,q,{{a,b},{c,d}}]
uses the quantile definition specified by parameters a, b, c, d.
Quantile[dist,q]
gives a quantile of the distribution dist.
Details


- Quantile is also known as value at risk (VaR) or fractile.
- Quantile[list,q] gives Sort[list,Less][[Max[Ceiling[qLength[list]],1]]].
- Quantile[{{x1,y1,…},{x2,y2,…},…},q] gives {Quantile[{x1,x2,…},q],Quantile[{y1,y2,…},q]}.
- For a list of length n, Quantile[list,q,{{a,b},{c,d}}] depends on x=a+(n+b)q. If x is an integer, the result is s[[x]], where s=Sort[list,Less]. Otherwise, the result is s[[Floor[x]]]+(s[[Ceiling[x]]]-s[[Floor[x]]])(c+dFractionalPart[x]), with the indices taken to be 1 or n if they are out of range.
- The default choice of parameters is {{0,0},{1,0}}.
- Common choices of parameters include:
-
{{0, 0}, {1, 0}} inverse empirical CDF (default) {{0, 0}, {0, 1}} linear interpolation (California method) {{1/2, 0}, {0, 0}} element numbered closest to qn {{1/2, 0}, {0, 1}} linear interpolation (hydrologist method) {{0, 1}, {0, 1}} mean‐based estimate (Weibull method) {{1, -1}, {0, 1}} mode‐based estimate {{1/3, 1/3}, {0, 1}} median‐based estimate {{3/8, 1/4}, {0, 1}} normal distribution estimate - Quantile[list,q] always gives a result equal to an element of list.
- The same is true whenever d is 0.
- When d is 1, Quantile is piecewise linear as a function of q.
- Median[list] is equivalent to Quantile[list,1/2,{{1/2,0},{0,1}}].
- About 10 different choices of parameters are in use in statistical work.
- Quantile works with SparseArray objects.
- Quantile[dist,q] is equivalent to InverseCDF[dist,q].
Examples
open allclose allBasic Examples (6)
Scope (24)
Datasets (11)
Quantile works with any real numeric quantities:
Find quantiles of elements in each column:
Find multiple quantiles of elements in each column:
Obtain results at any precision:
Compute results for a large vector or matrix:
Compute results for a SparseArray:
Compute results using other parametrizations:
Find quantiles for WeightedData:
Find quantiles for EventData:
Find a quantile for TimeSeries:
Parametric Distributions (5)
Obtain a machine-precision result:
Obtain a result at any precision for a continuous distribution:
Obtain a symbolic expression for the quantile:
Quantile threads elementwise over lists:
Nonparametric Distributions (2)
Quantile for nonparametric distributions:
Compare with the value for the underlying parametric distribution:
Derived Distributions (4)
Quantile for a truncated distribution:
Random Processes (2)
Quantile function for a random process:
Find a quantile of TemporalData at some time t=0.5:
Find the corresponding quantile function together with all the simulations:
Applications (7)
A set of equally spaced quantiles divides the values into
equal-sized groups:
Plot the PDF divided according to the values of quantiles into five regions:
Use quantile as a mesh function:
Plot the q quantile for a list:
The linearly interpolated quantile:
Compute an expectation using quantile :
Use this method in Expectation:
Generate random numbers for a nonuniform distribution by transforming the uniform distribution by the quantile function of the nonuniform distribution:
Compare the histogram of the sample with the probability density function of the desired distribution:
Compute a moving quantile for some data:
Compute selected quantiles for slices of a collection of paths of a random process:
Properties & Relations (9)
Use Quantile to find the quartiles of a distribution:
With default parameters, Quantile always returns an element of the list:
Quartiles gives linearly interpolated Quantile values for a list:
InterquartileRange is the difference of linearly interpolated Quantile values for a list:
QuartileDeviation is half the difference of linearly interpolated Quantile values for a list:
QuartileSkewness uses linearly interpolated Quantile values as a skewness measure:
Quantile is equivalent to InverseCDF for distributions:
QuantilePlot plots the quantiles of a list or distribution:
BoxWhiskerChart shows special quantiles for data:
Possible Issues (2)
Neat Examples (1)
The distribution of Quantile estimates for 20, 100, and 300 samples:
Text
Wolfram Research (2003), Quantile, Wolfram Language function, https://reference.wolfram.com/language/ref/Quantile.html (updated 2007).
CMS
Wolfram Language. 2003. "Quantile." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Quantile.html.
APA
Wolfram Language. (2003). Quantile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Quantile.html