Calculating Percentile from a pdf
Ältere Kommentare anzeigen
Hi,
I have a data with two columns: Column 1 is the variable, and Column 2 is the probability density. I am pasting a sample of the data, but overall cumsum(COlumn2) = 100, as it should be.

Question is, how do I get the 5th percentile of Column 1 (given the probabilities associated with each number). I have tried a number of things but coming at the dead-end. APologies in advance in case its too naive.
Akzeptierte Antwort
Weitere Antworten (1)
John D'Errico
am 5 Jun. 2019
Bearbeitet: John D'Errico
am 5 Jun. 2019
0 Stimmen
Pretty simple actually, though it is far easier as I can give you an example, than if you posted your actual data rather than a blasted picture of numbers. A picture of numbers is not worth a thousand words. Sorry, but I refuse to type in numbers from a picture.
But do this:
- Set the point at -9.42 to be zero.
- Use cumsum.
- Normalize the sum to 1.
- Interpolate (actually reverse interpolation.) at 0.05. You can do that using interp1, where x will be the cumulative probability, and y is the column 1 variable. Linear interpolation seems right.
You could also use the 'pchip' or 'makima' options in interp1 to interpolate. Do NOT use 'spline'.
1 Kommentar
Rohit Goel
am 6 Jun. 2019
Kategorien
Mehr zu Descriptive Statistics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!