MATLAB Answers

Plot and fit exponential decay probability of population

10 views (last 30 days)
Hello
I have a population
example=[1,1,2,4,NaN,NaN,10,200,50]
were each value is the time were the respective element of the population "dies" with "NaN" being elements, that never "die".
I am looking for a way to plot the propability that an element "dies" by the funtion of time converging to the relative amount ('NaN') of elements "surviving" as well as to fit this with a exponential decay curve (I know from e.g. histfit, that my data resembles this behaviour).
I already tried to use the hazard function or to plot 1-cdf.
Thanks for advance.

  1 Comment

Peter Mühlenbrock
Peter Mühlenbrock on 23 Mar 2020
I got so far to fit the data without taking the amount of "NaN" into account.
figure(1)
ecdf(y,'function','survivor');
h=gcf;
dataObjs = findobj(gcf,'-property','YData');
dmy3=dataObjs.XData;
x=dmy3';
dmy4=dataObjs.YData;
y2=dmy4';
Up until now the survival function converges to 0. How can i make it converge to the amount of "NaN" in "y"?

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 23 Mar 2020
You are correct to use the ecdf function. I think the piece you are missing is the use of the 'censoring' input. Take a look at the example Empirical Hazard Function of Right-Censored Data

  2 Comments

Peter Mühlenbrock
Peter Mühlenbrock on 23 Mar 2020
Perfect, this is working now, thanks. How can I now extract the datapoints for further fitting including the bounds as a weighting factor for the fit? The way I did it above is giving me the upper bounds as yData
the cyclist
the cyclist on 23 Mar 2020
I'm not sure I fully understand your question. May I suggest you accept this answer, and then post a new question with a bit more detail about what you mean? I'll keep a lookout for it.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by