Classifications Logistic Regression
Example - Explanation & Prediction
Clearly, women of a young age in first class had the highest survival rate.
How do we know this? As class increases (from 1 to 3), survival probability decreases (-1.2957).
Furthermore, men (sexmale) had, on average, a much lower survival rate than women (-2.4546).
Lastly, increasing age negatively affected survival chances (-0.0387).
But how sure can we be of our model accuracy? We can test it by
predicting
some new data and
validating our predictions:
# predict on test data
fitted <- predict(Logistic_Mod, newdata=test_df, type='response')
# if predicted survival probability above .5 assume survival
fitted <- ifelse(fitted > 0.5 , 1, 0)
# compare actual data with predictions --> ERROR RATE
mean(fitted != test_df$Survived)
## [1] 0.2
In reality, one would fine-tune the probability at which to assume survivorship!
Aarhus University Biostatistics - Why? What? How? 15 / 35