Use sample data to estimate quantiles, the median among them.
The idea
A sample quantile is read from the ordered data. The median is the middle observation when n is odd and the average of the two middle observations when n is even, and the data must be sorted first. For a general quantile q, one simple convention counts from the smallest value and takes the observation at Position = ceiling(n × q). For a 5% lower-tail quantile of 100 returns, that is the 5th smallest. This is how historical simulation estimates VaR. Quantiles and the median depend on ranks, so they are robust to outliers, unlike the mean, which moves with every extreme value. Rounding and counting from the wrong end are the typical errors, and the question usually states which convention to use.
Formulas
Position of a sample quantile
Position = ⌈n × q⌉
- n
- the number of observations
- q
- the quantile probability
Count from the smallest value of the sorted data and round up. Questions usually state the convention, so check it before counting.
A practice question
Six daily returns (in %) are 1.2, -0.5, 2.8, 0.4, -1.9 and 3.5. What is the sample median?
- 0.40%Why not: Takes the lower of the two middle values instead of averaging them.
- 0.80% - correct
- 1.20%Why not: Takes the upper of the two middle values instead of averaging them.
- 0.92%Why not: Calculates the mean rather than the median.
Ordered: -1.9, -0.5, 0.4, 1.2, 2.8, 3.5. With n = 6 the median is the average of the 3rd and 4th values: (0.4 + 1.2)/2 = 0.80%.
A harder one
A risk manager estimates the 5% quantile of 40 daily returns as the ceiling(n x 0.05)-th smallest observation. The five smallest returns (in %) are -4.8, -3.9, -3.1, -2.7 and -2.4. What is the estimate?
- -4.8%Why not: Takes the minimum, treating the worst observation as the 5% quantile.
- -3.1%Why not: Uses the (n x 0.05 + 1) = 3rd smallest observation rather than the 2nd.
- -3.9% - correct
- -2.4%Why not: Picks the 5th smallest observation, confusing the 5% level with a count of five observations.
n x 0.05 = 2, so the estimate is the 2nd smallest observation: -3.9%. This is the historical-simulation 95% VaR loss of 3.9%, reported as a positive number.
The hardest tier
A risk manager estimates the 1% quantile of 250 daily returns as the ceiling(n x q)-th smallest observation. The five smallest returns (in %) are -6.2, -5.1, -4.4, -3.8, -3.5. What is the estimate?
- -4.4% - correct
- -5.1%Why not: Rounds n x q = 2.5 down to 2 rather than up to 3.
- -3.8%Why not: Uses ceiling(n x q) + 1 = 4th smallest, adding an extra position.
- -6.2%Why not: Takes the single worst return, treating it as the 1% quantile.
n x q = 250 x 0.01 = 2.5, which rounds up to 3, so the estimate is the 3rd smallest observation: -4.4%. The estimated 99% VaR is a loss of 4.4%.
In the app: 6 practice questions on this outcome, spaced review that brings it back before you forget it.
Start free →More in Sample Moments
- Use sample data to estimate a mean, a variance and a standard deviation.
- Describe how a sample moment differs from a population moment.
- Distinguish an estimator, which is a rule, from an estimate, which is a value it produces.
- Explain what the bias of an estimator is and what it indicates about the estimator.
- Interpret the claim that the estimator of the mean is BLUE.
- Define the consistency of an estimator and describe why the idea is useful.
- Apply the Central Limit Theorem (CLT) and the Law of Large Numbers (LLN) to a sample mean, saying what each result implies.
- Use data to estimate the skewness and kurtosis of a random variable and interpret the results.
- Apply the CLT after estimating the means of two variables from sample data.
- From sample data, calculate estimates of how two random variables covary and how they correlate.
- Relate coskewness and cokurtosis back to the skewness and kurtosis of a single variable.