Introduction

In the realm of healthcare, understanding and predicting mortality outcomes is of paramount importance for effective patient care and management. This research delves into a comprehensive dataset focused on mortality, which encapsulates a diverse array of clinical and demographic factors associated with individuals experiencing critical health events.

The dataset encompasses 299 observations, each characterized by 13 distinct features. These features include demographic information such as age and sex, clinical indicators like serum creatinine levels, ejection fraction, and high blood pressure, as well as lifestyle factors such as smoking status and the presence of diabetes. Additionally, the dataset tracks vital medical information like platelet count, serum sodium levels, and creatinine phosphokinase levels.

The primary objective of this research is to investigate the factors contributing to mortality outcomes among the observed individuals. By employing statistical analyses and potentially leveraging machine learning techniques, the study aims to identify patterns, correlations, and predictive indicators associated with mortality. The “DEATH_EVENT” variable serves as a critical focal point, representing the occurrence or absence of a fatal event.

Understanding the intricate relationships among these variables can provide valuable insights for healthcare practitioners, aiding in the development of risk assessment models, personalized treatment strategies, and interventions aimed at improving patient outcomes. The comprehensive nature of the dataset, covering a spectrum of clinical, demographic, and lifestyle aspects, positions this research to contribute to the broader understanding of mortality in the context of cardiovascular health.

As we explore the dataset, the goal is to uncover nuanced patterns and relationships that can inform medical professionals, researchers, and policymakers, ultimately contributing to advancements in the field of mortality prediction and patient care.

About

The dataset at hand is a collection of information related to individuals, with each row representing a distinct observation or case. The dataset contains various attributes that can be broadly categorized into numerical and categorical columns.

Numerical Columns:

Numerical columns in the dataset include features such as age, creatinine phosphokinase levels, ejection fraction, platelet count, serum creatinine, serum sodium, and time. These columns consist of continuous numerical values that capture various physiological and clinical measurements.

Categorical Columns:

Categorical columns include anaemia, diabetes, high blood pressure, sex, and smoking. These columns represent categorical variables with binary values (0 or 1) indicating the absence or presence of certain conditions or characteristics.

Target Variable:

The target variable, which is the variable of interest for predictive modeling or analysis, is the last column labeled “DEATH_EVENT.” This binary variable indicates whether an individual experienced a death event (1) or not (0). In the context of the dataset, the goal may involve predicting the likelihood of a death event based on the other features present in the dataset.

Understanding the nature of numerical and categorical variables, as well as identifying the target variable, is crucial for subsequent exploratory data analysis and modeling tasks.

Finding the strongest and weakest Correlation

Selecting the feature “Age” finding the correlation of Age and all the other variables

Mortality = read.csv("Mortality.csv")
cor_anaemia = cor(Mortality$age, Mortality$anaemia)
cor_creatinine_phosphokinase = cor(Mortality$age, Mortality$creatinine_phosphokinase)
cor_diabetes = cor(Mortality$age, Mortality$diabetes)
cor_ejection_fraction = cor(Mortality$age, Mortality$ejection_fraction)
cor_high_blood_pressure = cor(Mortality$age, Mortality$high_blood_pressure)
cor_platelets = cor(Mortality$age, Mortality$platelets)
cor_serum_creatinine = cor(Mortality$age, Mortality$serum_creatinine)
cor_serum_sodium = cor(Mortality$age, Mortality$serum_sodium)
cor_sex = cor(Mortality$age, Mortality$sex)

all_cors = c(cor_anaemia, cor_creatinine_phosphokinase, cor_diabetes, cor_ejection_fraction, cor_high_blood_pressure, cor_platelets, cor_serum_creatinine, cor_serum_sodium, cor_sex)
all_cors
## [1]  0.08800644 -0.08158390 -0.10101239  0.06009836  0.09328868 -0.05235437
## [7]  0.15918713 -0.04596584  0.06542952

Finding out the strongest correlation

strong = all_cors[1]
for(i in 1: length(all_cors)){
  if(all_cors[i]>strong){
    strong = all_cors[i]
  }
}
strong
## [1] 0.1591871

The correlation of Age and serum_creatinine is the strongest. It is a positive correlation.

all_cors_positive = c()
for(i in 1: length(all_cors)){
  if(all_cors[i]<0){
    all_cors_positive = c(all_cors_positive, all_cors[i]*-1)
  }else{all_cors_positive = c(all_cors_positive, all_cors[i])}
}
all_cors_positive
## [1] 0.08800644 0.08158390 0.10101239 0.06009836 0.09328868 0.05235437 0.15918713
## [8] 0.04596584 0.06542952

Finding out the weakest correlation

weak = all_cors[1]
for(i in 1: length(all_cors_positive)){
  if(all_cors_positive[i]<weak){
    weak = all_cors[i]
  }
}
weak
## [1] -0.0815839

The correlation of Age and creatinine_phosphokinase is the weakest. It is a negative correlation.

subset0 = Mortality[Mortality$DEATH_EVENT == 0, ]
subset0
summary(subset0)
##       age           anaemia       creatinine_phosphokinase    diabetes     
##  Min.   :40.00   Min.   :0.0000   Min.   :  30.0           Min.   :0.0000  
##  1st Qu.:50.00   1st Qu.:0.0000   1st Qu.: 109.0           1st Qu.:0.0000  
##  Median :60.00   Median :0.0000   Median : 245.0           Median :0.0000  
##  Mean   :58.76   Mean   :0.4089   Mean   : 540.1           Mean   :0.4187  
##  3rd Qu.:65.00   3rd Qu.:1.0000   3rd Qu.: 582.0           3rd Qu.:1.0000  
##  Max.   :90.00   Max.   :1.0000   Max.   :5209.0           Max.   :1.0000  
##  ejection_fraction high_blood_pressure   platelets      serum_creatinine
##  Min.   :17.00     Min.   :0.0000      Min.   : 25100   Min.   :0.500   
##  1st Qu.:35.00     1st Qu.:0.0000      1st Qu.:219500   1st Qu.:0.900   
##  Median :38.00     Median :0.0000      Median :263000   Median :1.000   
##  Mean   :40.27     Mean   :0.3251      Mean   :266658   Mean   :1.185   
##  3rd Qu.:45.00     3rd Qu.:1.0000      3rd Qu.:302000   3rd Qu.:1.200   
##  Max.   :80.00     Max.   :1.0000      Max.   :850000   Max.   :6.100   
##   serum_sodium        sex            smoking            time        DEATH_EVENT
##  Min.   :113.0   Min.   :0.0000   Min.   :0.0000   Min.   : 12.0   Min.   :0   
##  1st Qu.:135.5   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.: 95.0   1st Qu.:0   
##  Median :137.0   Median :1.0000   Median :0.0000   Median :172.0   Median :0   
##  Mean   :137.2   Mean   :0.6502   Mean   :0.3251   Mean   :158.3   Mean   :0   
##  3rd Qu.:140.0   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:213.0   3rd Qu.:0   
##  Max.   :148.0   Max.   :1.0000   Max.   :1.0000   Max.   :285.0   Max.   :0

Observations on subset0

Individuals with DEATH_EVENT equal to 0 did not experience the event being studied, which, in this case, is likely a death event. It indicates that the individual is alive or did not experience the outcome under consideration.

Age Distribution:

The age distribution shows a range from 40 to 90 years. The majority of individuals in this subset fall within the 50 to 65 age range, as indicated by the first and third quartiles.

Clinical Measurements:

Creatinine phosphokinase levels vary widely, with a minimum of 30 and a maximum of 5209. Ejection fraction values range from 17 to 80, with a median value of 38. Platelet counts exhibit variability, ranging from 25,100 to 850,000.

Health Conditions:

The majority of individuals in this subset do not have anemia, diabetes, or high blood pressure, as suggested by the lower quartiles. Smoking is present in approximately one-third of the cases.

Laboratory Results:

Serum creatinine levels vary, with a mean value of 1.185. Serum sodium levels are relatively consistent, with a mean around 137.

Demographic Information:

The dataset consists of both male and female individuals, with a binary representation (0 or 1) for gender. About 65% of the individuals in this subset are male.

Time :

The time variable indicates the duration of follow-up, ranging from 12 to 285 units. These observations provide a snapshot of the characteristics and health status of the individuals in the subset, highlighting key features of their demographic, clinical, and laboratory profiles. Further analyses and visualizations could offer deeper insights into relationships and patterns within the data.

subset1 = Mortality[Mortality$DEATH_EVENT == 1, ]
summary(subset1)
##       age           anaemia       creatinine_phosphokinase    diabetes     
##  Min.   :42.00   Min.   :0.0000   Min.   :  23.0           Min.   :0.0000  
##  1st Qu.:55.00   1st Qu.:0.0000   1st Qu.: 128.8           1st Qu.:0.0000  
##  Median :65.00   Median :0.0000   Median : 259.0           Median :0.0000  
##  Mean   :65.22   Mean   :0.4792   Mean   : 670.2           Mean   :0.4167  
##  3rd Qu.:75.00   3rd Qu.:1.0000   3rd Qu.: 582.0           3rd Qu.:1.0000  
##  Max.   :95.00   Max.   :1.0000   Max.   :7861.0           Max.   :1.0000  
##  ejection_fraction high_blood_pressure   platelets      serum_creatinine
##  Min.   :14.00     Min.   :0.0000      Min.   : 47000   Min.   :0.600   
##  1st Qu.:25.00     1st Qu.:0.0000      1st Qu.:197500   1st Qu.:1.075   
##  Median :30.00     Median :0.0000      Median :258500   Median :1.300   
##  Mean   :33.47     Mean   :0.4062      Mean   :256381   Mean   :1.836   
##  3rd Qu.:38.00     3rd Qu.:1.0000      3rd Qu.:311000   3rd Qu.:1.900   
##  Max.   :70.00     Max.   :1.0000      Max.   :621000   Max.   :9.400   
##   serum_sodium        sex            smoking            time       
##  Min.   :116.0   Min.   :0.0000   Min.   :0.0000   Min.   :  4.00  
##  1st Qu.:133.0   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.: 25.50  
##  Median :135.5   Median :1.0000   Median :0.0000   Median : 44.50  
##  Mean   :135.4   Mean   :0.6458   Mean   :0.3125   Mean   : 70.89  
##  3rd Qu.:138.2   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:102.25  
##  Max.   :146.0   Max.   :1.0000   Max.   :1.0000   Max.   :241.00  
##   DEATH_EVENT
##  Min.   :1   
##  1st Qu.:1   
##  Median :1   
##  Mean   :1   
##  3rd Qu.:1   
##  Max.   :1

Observations on subset1

Individuals with DEATH_EVENT equal to 1 experienced the event being studied. In this case, it likely indicates that the individual experienced a death event during the study or follow-up period.

Age Distribution:

The age range of individuals in the subset is from 42 to 95 years. The majority of individuals are in the age range of 55 to 75 years, as indicated by the first and third quartiles.

Health Conditions:

About 48% of individuals in the subset have anemia. The majority of individuals do not have diabetes, as indicated by the lower quartile.

Clinical Measurements:

Creatinine phosphokinase levels vary widely, ranging from 23 to 7861. Ejection fraction values range from 14 to 70, with a median value of 30.

Blood Pressure and Platelet Count:

Approximately 41% of individuals have high blood pressure. Platelet counts vary, with a median value of 258,500.

Serum Measurements:

Serum creatinine levels have a wide range, from 0.6 to 9.4, with a mean value of 1.836. Serum sodium levels range from 116 to 146.

Demographic Information:

The majority of individuals in the subset are male (around 65%). Smoking is present in approximately 31% of the cases.

Follow-up Time:

The time variable indicates the duration of follow-up, ranging from 4 to 241 units.

It’s important to note that the subset seems to consist entirely of individuals who experienced a death event (DEATH_EVENT equal to 1), and the summary statistics for other variables provide insights into their health conditions and clinical measurements. Further analysis and interpretation may involve comparing this subset with other subsets or the overall dataset to draw more comprehensive conclusions.

cor_anaemia0 = cor(subset0$age, subset0$anaemia)
cor_creatinine_phosphokinase0 = cor(subset0$age, subset0$creatinine_phosphokinase)
cor_diabetes0 = cor(subset0$age, subset0$diabetes)
cor_ejection_fraction0 = cor(subset0$age, subset0$ejection_fraction)
cor_high_blood_pressure0 = cor(subset0$age, subset0$high_blood_pressure)
cor_platelets0 = cor(subset0$age, subset0$platelets)
cor_serum_creatinine0 = cor(subset0$age, subset0$serum_creatinine)
cor_serum_sodium0 = cor(subset0$age, subset0$serum_sodium)
cor_sex0 = cor(subset0$age, subset0$sex)

all_cors0 = c(cor_anaemia0, cor_creatinine_phosphokinase0, cor_diabetes0, cor_ejection_fraction0, cor_high_blood_pressure0, cor_platelets0, cor_serum_creatinine0, cor_serum_sodium0, cor_sex0)
all_cors0
## [1]  0.078777645 -0.040551696 -0.078188249  0.084411089  0.089570000
## [6] -0.108694874  0.137589326 -0.019534566  0.009177758

Observation on the changes in correlation (subset0)

Analyzing the changes in correlations between two datasets (overall dataset and subset0):

Anaemia:

The correlation with anaemia has decreased from 0.088 in overall dataset to 0.079 in subset0 (dataset with DEATH_EVENT = 0). This suggests a slightly weaker positive correlation between age and anaemia in individuals where DEATH_EVENT is 0.

Creatinine Phosphokinase:

The correlation with creatinine_phosphokinase has decreased from -0.082 in overall dataset to -0.041 in subset0 The negative correlation between age and creatinine_phosphokinase is weaker in the subset where DEATH_EVENT is 0.

Diabetes:

The correlation with diabetes has changed from -0.101 in overall dataset to -0.078 in subset0 The negative correlation between age and diabetes is slightly weaker in the subset where DEATH_EVENT is 0.

Ejection Fraction:

The correlation with ejection_fraction has increased from 0.060 in overall dataset to 0.084 in subset0 The positive correlation between age and ejection_fraction is stronger in the subset where DEATH_EVENT is 0.

High Blood Pressure:

The correlation with high_blood_pressure has increased from 0.093 in overall dataset to 0.090 in subset0 The positive correlation between age and high_blood_pressure is slightly stronger in the subset where DEATH_EVENT is 0.

Platelets:

The correlation with platelets has increased from -0.052 in overall dataset to -0.109 in subset0 The negative correlation between age and platelets is more pronounced in the subset where DEATH_EVENT is 0.

Serum Creatinine:

The correlation with serum_creatinine has decreased from 0.159 in overall dataset to 0.138 in subset0 The positive correlation between age and serum_creatinine is weaker in the subset where DEATH_EVENT is 0.

Serum Sodium:

The correlation with serum_sodium has decreased from -0.046 in overall dataset to -0.020 in subset0. The negative correlation between age and serum_sodium is weaker in the subset where DEATH_EVENT is 0.

Sex:

The correlation with sex has decreased from 0.065 in overall dataset to 0.009 in subset0. The positive correlation between age and sex is substantially weaker in the subset where DEATH_EVENT is 0.

Overall Observation:

The changes in correlations between overall dataset and subset0 indicate that the relationships between age and certain variables vary when considering only individuals where DEATH_EVENT is 0. These changes can provide insights into how specific health indicators may differ in individuals who did not experience a death event.

cor_anaemia1 = cor(subset1$age, subset1$anaemia)
cor_creatinine_phosphokinase1 = cor(subset1$age, subset1$creatinine_phosphokinase)
cor_diabetes1 = cor(subset1$age, subset1$diabetes)
cor_ejection_fraction1 = cor(subset1$age, subset1$ejection_fraction)
cor_high_blood_pressure1 = cor(subset1$age, subset1$high_blood_pressure)
cor_platelets1 = cor(subset1$age, subset1$platelets)
cor_serum_creatinine1 = cor(subset1$age, subset1$serum_creatinine)
cor_serum_sodium1 = cor(subset1$age, subset1$serum_sodium)
cor_sex1 = cor(subset1$age, subset1$sex)

all_cors1 = c(cor_anaemia1, cor_creatinine_phosphokinase1, cor_diabetes1, cor_ejection_fraction1, cor_high_blood_pressure1, cor_platelets1, cor_serum_creatinine1, cor_serum_sodium1, cor_sex1)
all_cors1
## [1]  0.06624606 -0.16314530 -0.14938939  0.21688505  0.05421793  0.07237915
## [7]  0.06321810  0.03550256  0.17118610

Observation on the changes in correlation (subset1)

Analyzing the changes in correlations between two datasets (whole dataset and the subset1):

Anaemia:

The correlation with anaemia has decreased from 0.088 in overall dataset to 0.066 in subset1 (dataset with DEATH_EVENT = 1). This suggests a weaker positive correlation between age and anaemia in individuals who experienced a death event (DEATH_EVENT = 1).

Creatinine Phosphokinase:

The correlation with creatinine_phosphokinase has decreased from -0.082 in overall dataset to -0.163 in subset1 The negative correlation between age and creatinine_phosphokinase is much stronger in the subset where DEATH_EVENT is 1.

Diabetes:

The correlation with diabetes has decreased from -0.101 in overall dataset to -0.149 in subset1 The negative correlation between age and diabetes is stronger in individuals who experienced a death event (DEATH_EVENT = 1).

Ejection Fraction:

The correlation with ejection_fraction has increased from 0.060 in overall dataset to 0.217 in subset1 The positive correlation between age and ejection_fraction is significantly stronger in individuals who experienced a death event (DEATH_EVENT = 1).

High Blood Pressure:

The correlation with high_blood_pressure has changed from 0.093 in overall dataset to 0.054 in subset1 The positive correlation between age and high_blood_pressure is weaker in individuals who experienced a death event (DEATH_EVENT = 1).

Platelets:

The correlation with platelets has increased from -0.052 in overall dataset to 0.072 in subset1 The negative correlation between age and platelets is less pronounced in individuals who experienced a death event (DEATH_EVENT = 1).

Serum Creatinine:

The correlation with serum_creatinine has changed from 0.159 in overall dataset to 0.063 in subset1 The positive correlation between age and serum_creatinine is weaker in individuals who experienced a death event (DEATH_EVENT = 1).

Serum Sodium:

The correlation with serum_sodium has changed from -0.046 in overall dataset to 0.036 in subset1 The negative correlation between age and serum_sodium is slightly stronger in individuals who experienced a death event (DEATH_EVENT = 1).

Sex:

The correlation with sex has increased from 0.065 in overall dataset to 0.171 in subset1 The positive correlation between age and sex is substantially stronger in individuals who experienced a death event (DEATH_EVENT = 1).

Overall Observation:

The changes in correlations between overall dataset and subset1 indicate that the relationships between age and certain variables vary when considering only individuals who experienced a death event. These changes can provide insights into how specific health indicators may differ in individuals who had a death event compared to the overall dataset.

What I want to do with this dataset

Survival Analysis:

  • Conduct survival analysis to understand the time until the occurrence of a death event.
  • Utilize Kaplan-Meier curves and statistical tests to compare survival distributions.

Feature Importance Analysis:

  • Explore feature importance to identify which variables contribute significantly to the prediction of death events.

Machine Learning Classification:

  • Develop machine learning models to predict the likelihood of death events based on patient characteristics.
  • Evaluate model performance using metrics like accuracy, precision, recall, and area under the ROC curve (AUC-ROC).

Exploratory Data Analysis (EDA):

  • Visualize the distribution of variables and relationships using charts and graphs to gain insights.

Risk Stratification:

  • Stratify patients into risk groups based on their predicted probability of death events.