2
$\begingroup$

Let's say I have a medical dataset/EHR dataset that is retrospective and longitudinal in nature. Meaning one person has multiple measurements across multiple time points (in the past). I did post here but couldn't get any response. So, posting it here

This dataset contains information about patients' diagnosis, mortality flag, labs, admissions, and drugs consumed, etc.

Now, if I would like to find out predictors that can influence mortality, I can use logistic regression (whether the patient will die or not).

But my objective is to find out what are the predictors that can help me predict whether a person will die in the next 30 days or the next 240 days, how can I do this using ML/Data Analysis techniques?

In addition, I would also like to compute a score that can indicate the likelihood that this person will die in the next 30 days? How can I compute the scores? Any tutorials links on how is this score derived?, please?

Can you please let me know what are the different analytic techniques that I can use to address this problem and different approaches to calculate score?

I would like to read and try solving problems like this

$\endgroup$
2
$\begingroup$

This could be seen as a "simple" binary classification problem. I mean the type of problem is "simple", the task itself certainly isn't... And I'm not even going to mention the serious ethical issues about its potential applications!

First, obviously you need to have an entry in your data for a patient's death. It's not totally clear to me if you have this information? It's important that whenever a patient has died this is reported in the data, otherwise you cannot distinguish the two classes.

So the design could be like this:

  • An instance represents a single patient history at time $t$, and it is labelled as either alive or dead at $t+N$ days.
  • This requires refactoring the data. Assuming data spans a period from 0 to $T$, you can take multiple points in time $t$ with $t<T-N$ (for instance every month from 0 to $T-N$). Note that in theory I think that different times $t$ for the same patient can be used in the data, as long as all the instances consistently represent the same duration and their features and labels are calculated accordingly.
  • Designing the features is certainly the tricky part: of course the features must have values for all the instances, so you cannot rely on specific tests which were done only on some of the patients (well you can, but there is a bias for these features).
    • To be honest I doubt this part can be done reliably: either the features are made of standard homogeneous indicators, but then these indicators are probably poor predictors of death in general; or they contain specialized diagnosis tests for some patients but then they are not homogeneous across patients, so the model is going to be biased and likely to overfit.

Ideally I would recommend splitting between training and test data before even preparing the data in this way, typically by picking a period of time for training data and another for test data.

Once the data is prepared, in theory any binary classification method can be applied. Of course a probabilistic classifier can be used to predict a probability, but this can be misleading so be very careful: the probability itself is a prediction, it cannot be interpreted as the true chances of the patient to die or not. For example Naive Bayes is known to empirically always give extreme probabilities, i.e. close to 0 or close to 1, and quite often it's completely wrong in its prediction. This means that in general the predicted probability is only a guess, it cannot be used to represent confidence.


[edit: example]

Let's say we have:

  • data for years 2000 to 2005
  • N=1, i.e. we look at whether a patient dies in the next year.
  • a single indicator, for instance say cholesterol level. Of course in reality you would have many other features.
  • for every time $t$ in the features we represent the "test value" for the past 2 years to the current year $t$. This means that we can iterate $t$ from 2002 (2000+2) to 2004 (2005-N)

Let's imagine the following data (to simplify I assume the time unit is year):

patientId birthYear year     indicator 
1         1987      2000     26
1         1987      2001     34
1         1987      2002     18
1         1987      2003     43
1         1987      2004     31
1         1987      2005     36
2         1953      2000     47
2         1953      2001     67
2         1953      2002     56
2         1953      2003     69
2         1953      2004     -    DEATH
3         1969      2000     37
3         1969      2001     31
3         1969      2002     25
3         1969      2003     27
3         1969      2004     15
3         1969      2005     -    DEATH
4         1936      2000     41
4         1936      2001     39
4         1936      2002     43
4         1936      2003     43
4         1936      2004     40
4         1936      2005     38

That would be transformed into this:

patientId yearT age indicatorT-2 indicatorT-1 indicatorT-0   label
1         2002  15  26           34           18             0
1         2003  16  34           18           43             0
1         2004  17  18           43           31             0
2         2002  49  47           67           56             0
2         2003  50  67           56           69             1
3         2002  33  37           31           25             0
3         2003  34  31           25           27             0
3         2004  35  25           27           15             1
4         2002  66  41           39           43             0
4         2003  67  39           43           43             0
4         2004  68  43           43           40             0

Note that I wrote the first two columns only to show how the data is calculated, these two are not part of the features.

$\endgroup$
4
  • $\begingroup$ Yes, I do have death information. I might be wrong. Can't the simple Survival analysis techniques be used for this problem? Am new to this..So, but I see that's called as Time to Event models.. Do you know of any tutorials that can help me learn and solve this problem?Upvoted for the help $\endgroup$
    – The Great
    Nov 21 '20 at 0:52
  • $\begingroup$ Meaning, I have mortality status whether patient died or not. So based on your design, am I right to understand the below.. a) Identify a base line point.(something like patients with a specific condition who are aged 60 and above)..b) find when they died from the base line point (Is it < 30 days? or <90 days < 240 days) and create a new label..Am I right to understand this? $\endgroup$
    – The Great
    Nov 21 '20 at 1:11
  • $\begingroup$ @TheGreat I don't know much about survival analysis so I can't answer about that. In general there are certainly more advanced methods which could be applied, especially about taking time into account. My answer is just a simple representation of the problem, it can be used to see if the task is doable or not. No, what you describe is not what I meant, I'll try to edit my answer to clarify. See also Allohvk's answer in case it helps. $\endgroup$
    – Erwan
    Nov 21 '20 at 11:59
  • $\begingroup$ Thanks for your help @Erwan $\endgroup$
    – The Great
    Nov 25 '20 at 0:17
2
$\begingroup$

To clarify the questions raised by the user in response to the correct solution given by Erwan - the solution proposes going back in time to prepare the data across a series of timestamps.

There will be multiple points in time 't' where the input would be all the various features on the patients health, medication, reports etc..you need to see how best they can be converted to representational vectors. The labels would be a binary and indicate whether the patient lived after t+N days..where N can be 30,60,240 etc. 't' itself can be taken week on week or month on month.

Once data is prepared this way, it becomes a binary classification exercise.

The only additional consideration which can be added is - there could be elements of RNN here. The training data is not independent of one another and may contain recurring data of the same patient over multiple timestamps and perhaps there is a scope for capturing this information to model the situation better.

$\endgroup$
1
  • $\begingroup$ Thanks. Upvoted $\endgroup$
    – The Great
    Nov 25 '20 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.