Here is a sample dataset below:
age = runif(200, min = 25, max=70)
profile_id = seq(1, 200)
gender = sample(c("M", "F"), size = 200, replace = T)
start_date = sample(seq(as.Date('2013/01/01'), as.Date('2014/01/01'), by="month"), 200, replace = T)
end_date = sample(seq(as.Date('2014/01/01'), as.Date('2016/01/01'), by="month"), 200, replace = T)
mydf = data.frame(profile_id, age, gender, start_date, end_date)
mydf$end_date[mydf$end_date > as.Date('2015/01/01')] = as.Date('2015/01/01')
mydf$death = ifelse(mydf$end_date < as.Date('2015/01/01'), 1, 0)
mydf$periods_alive = mydf$end_date - mydf$start_date
Basically, if possible, I am trying to utilize some kind of survival regression model to predict for those who are still alive at the end of the time period, their probabilities of survival for future time periods after the study. For example the probability of survival at each month for the next 12 months or something.
I understand I could do something like this below to estimate probabilities of survival for new observations during the sample period (although I'm not entirely sure how to extract the probabilities from the predict function):
m1 = survreg(Surv(periods_alive, death)~ age + gender, data = mydf)
mydf_alive = mydf[mydf$death == 0, ]
predict(m1, newdata = mydf_alive, type = 'quantile')
But I was curious if there was a way to predict those probabilites of survival at some future time T for the censored observations. I'm not really hung up on using survival analysis if there's a better way to model these probabilities but I thought there was possibly some way to do this? Any help on how to proceed would be greatly appreciated!