HELP! Reading a probability from a CDF plot

5 visualizzazioni (ultimi 30 giorni)
Adele
Adele il 9 Mar 2011
I have created a CDF plot of some temperature data, and I need to find exceedence probability. Is there a way to input a specific number (i.e. an x-value) and have MATLAB return the exceedence probability?

Risposte (3)

Oleg Komarov
Oleg Komarov il 9 Mar 2011
Give a look at this FEX submission: exceedance probability.
Oleg

Matt Tearle
Matt Tearle il 9 Mar 2011
You basically want an inverse CDF calculation (based on measured data, rather than a formula)?
% Make some fake data
x = -4:0.2:4;
y = (1+tanh(x))/2;
% Pick a probability
yval = 0.72;
% Interpolate to find x such that y(x) = yval
f = @(t) interp1(x,y,t,'pchip') - yval;
xval = x(find(y>=yval,1,'first'))
xval = fzero(f,xval)
% See the result
plot(x,y,'o-',xval,yval,'*')
The idea is to find the first data point that exceeds the given probability, then use that as an initial guess to a root-finding algorithm to find the actual x such that y(x) = prob. The tricky thing is that you have to interpolate to get a function to do root-finding on. Hence the use of interp1.

Adele
Adele il 10 Mar 2011
Thanks for the advice, everyone!
I was able to ask my instructor and he told me to use the command "ecdf(input_data)" which gave me 2 matrices, one containing the temperature values I was given and the other contained the cdf values corresponding to the individual temperature values. From here, I was able to interpolate and find the exceedence probability.
I didn't try the other approaches because I am a beginner and didn't really understand what was going on.
  1 Commento
Matt Tearle
Matt Tearle il 11 Mar 2011
My code was intended to show how to do the interpolation (your question implied you already had the empirical CDF).

Accedi per commentare.

Categorie

Scopri di più su Descriptive Statistics and Visualization in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by