I have a retrospective EHR database from a hospital and I would like to build an ML model to predict whether a patient will die within 28 days or not (from discharge/some time point T)
Can I check with you on the below steps?
a) Let's say I have a sample of 5000 patients
b) I choose training data as 3500 patients
c) For these 3500 patients, I extract the required variables and their values till time "T"
d) And now for training data, we need labels, So I calculate using a python script whether this person has died within 28 days from time "t" (because I have all their data. I can find the difference between his discharge date and death date)
e) If yes, I will label it as "1" else "0"
f) I build a supervised learning model using logistic regression
Now comes the challenging part (for me atleast)
g) I would like to apply this model on the unseen set of 1500 patients
h) I extract the same variables as training data
i) Now I apply the model to this unseen data of 1500 patients
k) But the problem is this will only give whether the patient will die or not. How can I know whether he will die or not in the 28 days?
How can I incorporate this time component here.
Can somebody help me with this by providing easy to understand steps and which algorithm to use please?
survival
andrms
. There's a well supportedeha
(event history analysis) and more recently theflexsurv
package has become available. There is also a random survival forest package if you wnat to stay on the "data science" side of mythology (ooops, that was what my spell-chucker offered and it amused me) and don't want to stray into "real statistics". $\endgroup$