Borrar filtros
Borrar filtros

Calculate percentiles from empirical PDF values

14 visualizaciones (últimos 30 días)
Shyam Mudiraj
Shyam Mudiraj el 14 de Mzo. de 2019
Comentada: Sajid Afaque el 29 de Jun. de 2020
How can I calculate percentiles such 10%, 50% (median) and 90% based on the empirical probability density values?
  2 comentarios
Torsten
Torsten el 14 de Mzo. de 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 el 29 de Jun. de 2020
yeah i have a similar issue how can we calculate from discrete value (x,f) of eCDF ?

Iniciar sesión para comentar.

Respuestas (1)

David Rogers
David Rogers el 29 de Mzo. de 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