Effacer les filtres
Effacer les filtres

Calculate percentiles from empirical PDF values

15 vues (au cours des 30 derniers jours)
Shyam Mudiraj
Shyam Mudiraj le 14 Mar 2019
Commenté : Sajid Afaque le 29 Juin 2020
How can I calculate percentiles such 10%, 50% (median) and 90% based on the empirical probability density values?
  2 commentaires
Torsten
Torsten le 14 Mar 2019
What do you mean by "empirical probability density values" ? You mean discrete values (x,y) of the probability density function ?
Sajid Afaque
Sajid Afaque le 29 Juin 2020
yeah i have a similar issue how can we calculate from discrete value (x,f) of eCDF ?

Connectez-vous pour commenter.

Réponses (1)

David Rogers
David Rogers le 29 Mar 2019
The best way is to use the cumulative distribution function (CDF) as a lookup table. The CDF is the integral of the PDF. Starting from raw data, you could use ecdf:
[f, x] = ecdf(random('wbl', 3,1,15,1));
You could also get a CDF starting from a vector of normalized histogram counts by creating a cumulative sum,
f = cumsum(prob .* (x(2:end)-x(1:end-1)))
Where x is a vector of start and stop positions for each bin and "prob" is the empirical probability distribution in each bin.
To find the 10th percentile, you want the x coordinate between f < 0.1 and f > 0.1:
n = find(f>0.10, 1)
[x(n-1), x(n)]

Community Treasure Hunt

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

Start Hunting!

Translated by