The question
Thirty-day readmissions are a quality measure and a cost driver for hospitals. The aim was to find which patient factors matter and whether a model could flag high-risk patients early.
What I did
Cleaned and encoded 5,000 simulated diabetic patient records.
Ran chi-square tests and t-tests to see which factors relate to readmission.
Engineered total visits, procedures per day, medications per day and a high-risk flag.
Trained logistic regression and random forest models and compared them with confusion matrices and ROC curves.
What I found
Prior inpatient visits (r = 0.44) and emergency visits (r = 0.38) had the strongest link to readmission.
Readmitted patients stayed 7.8 days on average, against 5.6 for the others.
Admission type was significantly associated with readmission (chi-square 152.8, p below 0.001). Gender, race, A1C result and insulin were not.
Random forest reached 92% accuracy and a ROC AUC of 0.97. Total prior visits was the top feature.
Charts from the analysis



Limits to keep in mind
Simulated data
The data is simulated and 83.8% of patients are readmitted, far above real hospital rates. A model that always predicts readmission would already score 83.8%, so 92% is a modest gain. This project shows the workflow and not clinical performance.