How to find the quantiles of the estimated distribution.

9 views (last 30 days)
I have a random variable E follows a estimated distribution.Now I put the values of E in a vector,for example e=[-1:1], and the cumulative probability of each element in vector e is filled in vector P. How can I find the 95% quantile of E ?

Accepted Answer

the cyclist
the cyclist on 6 May 2013
So, if I understand, the vector P is effectively the cumulative distribution function (CDF). So, you just need to find which value of P is closest to 0.95. You could this this with
[~,idx95] = min(abs(P-0.95));
Then, to find the corresponding value of e, you could do
e_95 = e(idx95);
If P is not fine-grained enough, you may need to do some kind of interpolation as well.
  5 Comments
the cyclist
the cyclist on 7 May 2013
Just commenting on your last question (then I will try to give the broader problem some thought). There are a couple ways to do what you want, I think.
One way is to use the second index of the sort command:
[sorted_x, index] = sort(x);
The index will give the ordering, which could then be used for other vectors.
You could also put the vectors into one matrix, and use the sortrows() function.
doc sortrows
for details.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!