0

Possible Duplicate:
Finding 99% coverage in Matlab

How can I compute P10, P50 and P90 given an emperical distribution?

Where, P90 means that 90% of the estimates (or outcomes) are expected to be bigger than this estimate. P50 means that 50% of the estimates (or outcomes) are expected to be bigger than this estimate.

Community
  • 1
  • 1
  • @Jonas: I tried `quantile` function in the other question you referred to, however its different from my question. Here P10, P50, P90 represents the 10%, 50% and 90% certainty, respectively, of a value occurring from the values in my empirical distribution. See this: http://en.wikipedia.org/wiki/Hydrocarbon_exploration#Definition_of_oil_reserves –  Jun 10 '11 at 22:16
  • How is it different? Isn't it as simple as replacing 99 with 10, 50 and 90 as the case may be? – abcd Jun 10 '11 at 23:56
  • @yoda: Basically if I have 100 values in my distribution, then `quantile` gives 90 values for 90, 50 values with 50 and 10 values with 10. Whereas in fact there should be just one value for 90, 50 or 10. –  Jun 10 '11 at 23:59
  • Please read the [documentation](http://www.mathworks.com/help/toolbox/stats/quantile.html) first. Calling the function as `quantile(x,p)` where `0≤p≤1` will give you a single number that is the quantile. Calling it as `quantile(x,N)` where `N` is an integer will return something else (look in the docs). As an example, try `x=rand(1000,1);quantile(x,0.01)` – abcd Jun 11 '11 at 00:04

1 Answers1

2

If you have the statistics toolbox, prctile does the trick. If your data is X, then prctile(X,[10,50,90]) will return the 10th, 50th and 90th percentile.

If not, just sort the data and take the percentiles using indexing. If X has a small number of entries, be careful with interpolating.

MatlabSorter
  • 1,290
  • 1
  • 11
  • 19