# Balancing dataset for survival analysis

So I'm using survival analysis to help identify customers at risk of churning. As of now, I've been using a hugely imbalanced dataset that consists of 99.5% of customers in the majority class (i.e. not churned) and 0.5% churned. To improve my model I've randomly undersampled the majority class such that the ratio between the minority and majority classes is only 1/3, which resulted in improvements when compared to using the full dataset.

However, in order to avoid removing data points which can be important, I would like to try oversampling techniques such as SMOTE, etc but I don't know how well this would suit survival models, because the duration (target variable) depends on a churn date/time which is the result of the difference of two variables in the dataset (date_client_churned + date_client_joined). Isn't generating new examples going to mess with the distribution of these two variables and as such produce erratic results? Has anybody dealt with this kind of imbalance in the dataset for survival analysis, and if so what was your approach? Is it really necessary to balance the dataset for survival analysis?

For reference, the survival models that I've used are: Cox Proportional Hazards, Random Survival Forests and Gradient Boosted Trees with Cox loss.

Just to clarify how I compute the duration variable: For time t = 0 I'm using the date a customer signs a contract with the company, given by t_born, and for the end date I'm using either a) the churn date t_churn if t_churn < t_study, where t_study represents the end of the study period (t_study=t_born+6, t_study=t_born+12, t_study=t_born+24 months); b) t_study otherwise. The duration column will then be given by the difference t_churn - t_born if t_churn < t_study; t_study - t_born otherwise.

• It seems at first glance that the duration should be the difference of two dates, date_client_churned - date_client_joined, to represent the length of time that the individual was a client. Please edit the question to explain what you are using for the reference time = 0 for individual customers and why you are using the sum of those two dates for the duration survival time. Please do that by editing the question, as comments are easy to overlook and can be deleted. Also, note that this might better be handled by a cure model that accounts for individuals that never have events.
– EdM
Aug 9, 2022 at 15:00
• Misconceptions abound when it comes to class imbalance, and statistics sees little problem. Why do you think the class imbalance is problematic in your case?
– Dave
Aug 9, 2022 at 15:32
• The fact that you would create a new topic when this issue has been covered extensive on the site. Thinking class imbalance is a problem is equivalent to not understanding the field of statistics. Aug 9, 2022 at 15:58
• @EdM Thank you for the suggestion, I've added an explanation on the OP. Aug 9, 2022 at 16:34
• Any apparent improvement that comes from disrespecting the sample sizes is an illusion. And don't use the c-index to compare models. It's not good at that. Aug 9, 2022 at 23:17

Unbiased resampling by bootstrapping at the original sample size, however, is a very useful technique for validating and calibrating models, including survival models. See the validate() and calibrate() functions of Frank Harrell's rms package for example. Provided that you resample by case so that each set of t_born, t_churn and t_study is kept together, there is no problem.