0
$\begingroup$

I'm going to collect a sample of data that comes from an unknown, likely continuous, probability distribution. I don't really know anything about the data other than that it's somewhat chaotic. I want to know how to calculate a given percentile.

For example, suppose the dataset is 10 items, but I want to calculate the distribution's 95th percentile (the dataset isn't actually that small, this is just an example.) 95% of 10 is 9.5, and obviously there's no 9.5th smallest item.

So how do I calculate a percentile of this unknown distribution?

$\endgroup$
6
  • 1
    $\begingroup$ You can use the sample estimates of the mean and standard deviation, but you can say a little more than that on the basis of prior knowledge. Do know anything about the data? What do the numbers represent? $\endgroup$ Commented Dec 3, 2021 at 20:33
  • 1
    $\begingroup$ (This seems like an XY problem where you have question X (how to calculate quantiles) that you think you can solve by method Y (estimate the entire distribution), so you ask about Y instead of X, so I will assume you are interested in X.) The documentation in R for quantile, accessed via ?quantile, gives insights into methods of calculating quantiles. For instance, for x <- seq(1, 100, 1), I get different answers for quantile(x, 0.504) and quantile(0.505). $\endgroup$
    – Dave
    Commented Dec 3, 2021 at 21:06
  • $\begingroup$ @Dave thanks but I use TypeScript, not R. $\endgroup$
    – moonman239
    Commented Dec 3, 2021 at 21:19
  • 1
    $\begingroup$ The documentation discusses theory, which is independent of software. $\endgroup$
    – Dave
    Commented Dec 3, 2021 at 21:25
  • $\begingroup$ @Dave Thanks for pointing me to the documentation,but it's so full of mathematical jargon that it's difficult for me to follow along (I didn't take any statistics after graduating High School) $\endgroup$
    – moonman239
    Commented Dec 3, 2021 at 21:35

2 Answers 2

1
$\begingroup$

If you are familiar with a software package you can start by producing a histogram of the data and request the software to produce sample estimates of the percentiles. You can then investigate the calculations of percentile estimates by hand to better understand the methodology and compare your work to the software's results. In the example you provided if you have a sample of $10$ ordered values and are interested in estimating the $95^{th}$ percentile of the population, one approach would be to take the average of the $9^{th}$ and $10^{th}$ ordered values in your sample.

$\endgroup$
0
$\begingroup$

Rough estimate:

  1. Let "a" be the list of numbers.
  2. Sort "a" in ascending order if this has not already been done.
  3. The index i of the nth percentile = round(n * len(a)/100) - 1, where "round" rounds to the nearest whole number, and len(a) represents the length of the array.
  4. The nth percentile is the ith element of a.
$\endgroup$
1
  • 1
    $\begingroup$ Do you know nothing about the nature of the numbers? Probably you should do nothing more than summarise them with a dotplot. $\endgroup$ Commented Dec 3, 2021 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.