Discrete time survival function

Hello, Please I am still very new to MATLAB. I would like to know how to correctly write the overall survival function for each individual in my sample. That is, the likelihood that each individual survives up to the end of the duration less 1. Any help provided will be greatly appreciated. Thanks.

8 件のコメント

Image Analyst
Image Analyst 2018 年 1 月 20 日
編集済み: Image Analyst 2018 年 1 月 20 日
Impossible to answer. See this link. What is the time periods when you are going to check? Like every 0.01 or something? What is the probability to go from one time period to the next time period. Are you using the equation
numLeft = startingNumber * decayRatePerPeriod ^ numPeriods;
God'stime Eigbiremolen
God'stime Eigbiremolen 2018 年 1 月 20 日
Thanks for your response. Time is measured per year in my data and the duration under study is 18 years. My N (observation) is 2013. I have already estimated the exit probability (hazard rate) and the survival function is simply 1-hazard. But what I am unable to do is to estimate a survival function for each individual. Not sure whether to use a loop or cumprod. I have attached a picture of the function. By the way, I clicked on the link you provided, but it says not available. Thanks
Walter Roberson
Walter Roberson 2018 年 1 月 20 日
prod(1-h)
for vector h.
That is, each h(i) is a probability of a hazard killing the individual, and the individual does not survive unless it survives all of the hazards, 1-h(i) is the probability of survival, so prod(1-h) is the probability of surviving all of them.
God'stime Eigbiremolen
God'stime Eigbiremolen 2018 年 1 月 20 日
Thanks Walter for your response. Please, how do I do this for all the individuals in my sample? Do I need to use a loop? Thought of using cumprod, but I was not sure how appropriate this is for my case.
Walter Roberson
Walter Roberson 2018 年 1 月 20 日
編集済み: Walter Roberson 2018 年 1 月 20 日
Are the hazards different for each individual? If not then you just calculate survival_rate = prod(1-h) once overall, and after that survival is just
individual_lives = rand(1, number_of_individuals_in_population) <= survival_rate;
to generate a logical vector of whether each individual survives.
God'stime Eigbiremolen
God'stime Eigbiremolen 2018 年 1 月 20 日
Yes, the hazards are different for each individual in my sample. The reason I was considering a loop or cumprod, but I am not sure how to do this correctly. Thanks again for your time.
Walter Roberson
Walter Roberson 2018 年 1 月 20 日
If it is the same number of hazards for each (even if that means a bunch of hazards with 0 threat) then you can prod() along the appropriate dimension to get the survival rate for each individual. I do not see any reason to cumprod() at the moment.
God'stime Eigbiremolen
God'stime Eigbiremolen 2018 年 1 月 21 日
Alright...many thanks, Walter.

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2018 年 1 月 20 日

1 投票

There are several discussions of survival analysis in the Statistics and Machine learning Toolbox documentation. See for example the coxphfit (link) function. Follow the links at the end of that page for other extended discussions on the same topic.

4 件のコメント

God'stime Eigbiremolen
God'stime Eigbiremolen 2018 年 1 月 20 日
Thanks Star for your response. I have actually looked at coxphfit before now. It works mainly for continuous data, whereas my data is discrete (grouped). So, I might not be able to use it in my case. I will need to write my own code and this is what I am currently struggling with.
Star Strider
Star Strider 2018 年 1 月 20 日
I did not realise you are using grouped data.
God'stime Eigbiremolen
God'stime Eigbiremolen 2018 年 1 月 20 日
Yes, it is. Thanks all the same Star.
Star Strider
Star Strider 2018 年 1 月 20 日
My pleasure.

サインインしてコメントする。

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by