Quantile
From Wikipedia, the free encyclopedia
Quantiles are points taken at regular intervals from the cumulative distribution function (CDF) of a random variable. Dividing ordered data into q essentially equal-sized data subsets is the motivation for q-quantiles; the quantiles are the data values marking the boundaries between consecutive subsets. Put another way, the kth q-quantile is the value x such that the probability that a random variable will be less than x is at most k/q and the probability that a random variable will be more than or equal to x is at least (q-k)/q. There are q − 1 quantiles, with k an integer satisfying 0 < k < q.
Contents |
[edit] Specialized quantiles
Some quantiles have special names:
- The 1000-quantiles are called permillages → Pr
- The 100-quantiles are called percentiles → P
- The 20-quantiles are called vigintiles → V
- The 12-quantiles are called duo-deciles → Dd
- The 10-quantiles are called deciles → D
- The 9-quantiles are called noniles (common in educational testing)→ NO
- The 5-quantiles are called quintiles → QU
- The 4-quantiles are called quartiles → Q
- The 3-quantiles are called tertiles or terciles → T
More generally, one can consider the quantile function for any distribution. This is defined for real variables between zero and one and is mathematically the inverse of the cumulative distribution function.
[edit] Quantiles of a population
For a population of discrete values or for a continuous population density the kth q-quantile is the data value where the cumulative distribution function crosses k/q. That is x is a kth q-quantile for a variable X if
(or, equivalently,
)
and
(or, equivalently,
).
For a finite population of N values indexed 1,...,N from lowest to highest, the kth q-quantile of this population can be computed via the value of
. If Ip is not an integer, then round up to the next integer to get the appropriate index; the corresponding data value is the kth q-quantile. On the other hand, if Ip is an integer then any number from the data value at that index to the data value of the next can be taken as the quantile, and it is conventional (though arbitrary) to take the average of those two values (see Estimating the quantiles ).
If, instead of using integers k and q, the "p-quantile" is based on a real number p with 0<p<1, then p replaces k/q in the above formulae. Some software programs (including Microsoft Excel) regard the minimum and maximum as the 0th and 100th percentile, respectively; however, such terminology is an extension beyond traditional statistics definitions.
[edit] Quantiles of a sample
The approach is different for a finite sample randomly drawn from a population. The kth q-quantile of a sample can be estimated via the value of
. If Is is an integer then it is the index of the data value that is the estimate of the kth q-quantile of the sample. On the other hand, if Is is not an integer but is between 1 and N then a (weighted) average of the data values for the adjacent integer indexes is typically used.
When Is is less than 1 or greater than N the kth q-quantile of the sample is typically not defined.
If, instead of using integers k and q, the "p-quantile" is based on a real number p with 0<p<1, then p replaces k/q in the above formulae.
This estimating approach is closely related to a result from order statistics. Specifically, the Isth smallest of N values drawn independently from the uniform distribution on [0,1] is a random variable with mean p = Is / (N + 1).
[edit] Examples
Consider a population of 10 data values {3, 6, 7, 8, 8, 10, 13, 15, 16, 20}.
- The first quartile is determined by 10*(1/4) = 2.5, which rounds up to 3, meaning that 3 is the rank in the population (from least to greatest values), at which approximately 1/4 of the values are less than this third value, which, in this case, is 7.
- The second quartile value (same as the median) is determined by 10*(2/4) = 5, which is an integer, while the number of values (10) is an even number, so the average of both the fifth and sixth values is taken—that is (8+10)/2 = 9, though any value from 8 through to 10 could be taken to be the median. If the number of data values is odd, then the median value (or 2nd quartile) is the value found at index=(#values + 1)/2.
So, for this example, if there had also been a value of 9 between values 8 and 10, making 11 values total, then (11+1)/2 = 6. This would mean that the sixth value (in this case, the value 9) would be the 2nd quartile, where 1/2 of the values are greater than this value (greater than 9—the value at index 6 of 11), and 1/2 of the values are less than the value at this index. - The third quartile value for the original example above is determined by 10*(3/4) = 7.5, which rounds up to 8, and the eighth value is 15.
The motivation for this method is that the first quartile should divide the data between the bottom quarter and top three-quarters. Ideally, this would mean 2.5 of the samples are below the first quartile and 7.5 are above, which in turn means that the third data sample is "split in two", making the third sample part of both the first and second quarters of data, so the quartile boundary is right at that sample.
Consider a sample of the same 10 data values {3, 6, 7, 8, 8, 10, 13, 15, 16, 20}, which are randomly drawn from some unknown population.
- The first quartile can be estimated via (10+1)*(1/4) = 2.75, which falls between 2 and 3, though is closer to the latter. An estimate for the first quartile is the weighted average of the second and third smallest values, which are 6 and 7 in this case. Specifically the estimate is 0.25(6) + 0.75(7) = 6.75.
- The second quartile can be estimated via (10+1)*(2/4) = 5.5, which falls between 5 and 6. An estimate is thus the average of the fifth and sixth smallest values, 0.5(8) + 0.5(10) = 9.
- The third quartile can be estimated via (10+1)*(3/4) = 8.25, which falls between 8 and 9. An estimate is thus the weighted average of the eighth and ninth smallest values, 0.75(15) + 0.25(16) = 15.25.
If there had also been a value of 9 between values 8 and 10, making 11 values total, the quartiles would have
values of 3, 6, and 9, respectively. Thus the quartiles estimates would be the data values 7, 9, and 15, respectively. Note that these values partition the remaining eight ordered data values into four equal-size groups {3,6}, {8,8}, {10,13}, and {16,20}.
[edit] Discussion
Standardized test results are commonly misinterpreted as a student scoring "in the 80th percentile", for example, as if the 80th percentile is an interval to score "in", which it is not; one can score "at" some percentile or between two percentiles, but not "in" some percentile. Perhaps by this example it is meant that the student scores between the 80th and 81st percentiles.
If a distribution is symmetric, then the median is the mean (so long as the latter exists). But, in general, the median and the mean differ. For instance, with a random variable that has an exponential distribution, any particular sample of this random variable will have roughly a 63% chance of being less than the mean. This is because the exponential distribution has a long tail for positive values, but is zero for negative numbers.
Quantiles are useful measures because they are less susceptible to long-tailed distributions and outliers. Empirically, if the data you are analyzing are not actually distributed according to your assumed distribution, or if you have other potential sources for outliers that are far removed from the mean, then quantiles may be more useful descriptive statistics than means and other moment-related statistics.
Closely related is the subject of least absolute deviations, a method of regression that is more robust to outliers than is least squares, in which the sum of the absolute value of the observed errors is used in place of the squared error. The connection is that the mean is the single estimate of a distribution that minimizes expected squared error while the median minimizes expected absolute error. Least absolute deviations shares the ability to be relatively insensitive to large deviations in outlying observations, although even better methods of robust regression are available.
The quantiles of a random variable are generally preserved under increasing transformations, in the sense that, for example, if m is the median of a random variable X, then 2m is the median of 2X, unless an arbitrary choice has been made from a range of values to specify a particular quantile. Quantiles can also be used in cases where only ordinal data is available.
[edit] Estimating the quantiles of a population
There are several methods for estimating the quantiles.[1] The most comprehensive breadth of methods is available in the R programming language, which includes nine estimation methods.[2]
The methods are largely to use some combination of the 2 nearest empirical quantiles that fall on a sample; for instance, if estimating the 43rd percentile in a sample with 10 values, one would use the 40th and 50th percentiles (the 4th and 5th values).
Let N be the number of non-missing values of the sample population, and let
represent the ordered values of the sample population such that x1 is the smallest value, etc. For the kth q-quantile, let p = k / q.
- Empirical distribution function

j is the integer part of
and g is the fractional part
- Empirical distribution function with averaging

j is the integer part of
and g is the fractional part
- Weighted average

j is the integer part of
and g is the fractional part. This method is used, for example, in the PERCENTILE function of Microsoft Excel.
- Sample number closest to (N-1)·p+1

j is the integer part of
and g is the fractional part
[edit] See also
[edit] References
- R.J. Serfling. Approximation Theorems of Mathematical Statistics. John Wiley & Sons, 1980.
- ^ Hyndman, R.J.; Fan, Y. (November 1996). "Sample Quantiles in Statistical Packages". American Statistician 50 (4): 361–365. doi:.
- ^ Frohne, I.; Hyndman, R.J. (2008). Sample Quantiles. R Project. ISBN 3-900051-07-0. http://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html.

