Plot and fit exponential decay probability of population

2 Ansichten (letzte 30 Tage)
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 Kommentar
Peter Mühlenbrock
Peter Mühlenbrock am 23 Mär. 2020
Bearbeitet: Peter Mühlenbrock am 23 Mär. 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"?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

the cyclist
the cyclist am 23 Mär. 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 Kommentare
Peter Mühlenbrock
Peter Mühlenbrock am 23 Mär. 2020
Bearbeitet: Peter Mühlenbrock am 23 Mär. 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 am 23 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by