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 ?
No products are associated with this question.
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.