
QUANTILEName:
Dataplot supports two methods for computing the quantile. The first method is based on the order statistic. The formula is:
where
An alternative method is called the HerrellDavis estimate. This method attempts to provide a lower standard error for X_{q} by utilizing all the order statistics rather than a single (or a weighted average of two) order statistic. Note that there are cases where the HerrellDavis has a substantially smaller standard error than the order statistic method. However, there are also cases where the reverse is true. To compute the HerrellDavis estimate, do the following:
Note: The computations for A and B were modified 2/2003 to:
B = (n+1)*(1  q) The original form was from the text in the Wilcox book. However, checking his S+ macros and verifying against the original Herrell and Davis article indicated that the new formulas are the correct ones.
<SUBSET/EXCEPT/FOR qualification> where <y> is the response variable; <quant> is a number or parameter in the range (0,1) that specifies the desired quantile; <par> is a parameter where the computed quantile is stored; and where the <SUBSET/EXCEPT/FOR qualification> is optional.
LET XQ = 0.50
The default method used by Dataplot described above is equivalent to method R6 of Hyndman and Fan. The method advocated by Hyndman and Fan is R8. For the R8 method,
where
If q ≤ (2/3)/(n+(1/3)) the minimum value will be returned and if q ≥ (n(1/3))/(n+(1/3)) the maximum value will be returned. Method R7 (this is the default method in R and Excel) is calculated by
where
If q = 1, then X_{n} is returned. The R6, R7, and R8 methods give fairly similar, but not exactly the same (particularly for small samples), results. For most purposes, any of these three methods should be acceptable.
R6 is equivalent to ORDER. ORDER is the default.
The specific quantile to compute is specified by entering the following command (before the plot command):
where <value> is a number in the interval (0,1) that specifies the desired quantile.
Rand Wilcox (1997), "Introduction to Robust Estimation and Hypothesis Testing", Academic Press. Frank Herrell and C. E. Davis, (1982), "A New DistributionFree Quantile Estimator", Biometrika, 69(3), 635640.
2003/2: Correction to HerrellDavis estimate. 2015/2: Support for R7 and R8 methods LET Y1 = LOGISTIC RANDOM NUMBERS FOR I = 1 1 100 LET XQ = 0.05 LET Q05A = XQ QUANTILE Y1 LET XQ = 0.95 LET Q95A = XQ QUANTILE Y1 SET QUANTILE METHOD HERRELL DAVIS LET XQ = 0.05 LET Q05B = XQ QUANTILE Y1 LET XQ = 0.95 LET Q95B = XQ QUANTILE Y1 LET Q05A = ROUND(Q05A,4) LET Q95A = ROUND(Q95A,4) LET Q05B = ROUND(Q05B,4) LET Q95B = ROUND(Q95B,4) PRINT "R6 METHOD: 0.05 Quantile = ^Q05A" PRINT "R6 METHOD: 0.95 Quantile = ^Q95A" PRINT "HD METHOD: 0.05 Quantile = ^Q05B" PRINT "HD METHOD: 0.95 Quantile = ^Q95B"The following output is generated R6 METHOD: 0.05 Quantile = 2.5442 R6 METHOD: 0.95 Quantile = 3.4716 HD METHOD: 0.05 Quantile = 2.7308 HD METHOD: 0.95 Quantile = 3.3067Program 2: . Step 1: Read the data (from eHandbook example) . read y 95.1772 95.1567 95.1937 95.1959 95.1442 95.0610 95.1591 95.1195 95.1065 95.0925 95.1990 95.1682 end of data . . Step 2: Compute the quantiles using different methods . let xq = 0.90 . let xqr6 = quantile y let xqr6 = round(xqr6,4) . set quantile method r7 let xqr7 = quantile y let xqr7 = round(xqr7,4) . set quantile method r8 let xqr8 = quantile y let xqr8 = round(xqr8,4) . . Step 3: Print the results . print "Quantile with R6 method: ^xqr6" print "Quantile with R7 method: ^xqr7" print "Quantile with R8 method: ^xqr8"The following output is generated Quantile with R6 method: 95.1981 Quantile with R7 method: 95.1957 Quantile with R8 method: 95.1972  
Privacy
Policy/Security Notice
NIST is an agency of the U.S. Commerce Department.
Date created: 07/22/2002 