| Start |
|---|
| Logistic regression on Titanic dataset Logistic regression is a particular case of the generalized linear model, used to model dichotomous outcomes (probit and complementary log-log models are closely related). The name comes from the link function used, the logit or log-odds function. The inverse function of the logit is called the logistic function and is given by: This function takes a value between ]-Inf;+Inf[ and returns a value between 0 and 1; i.e the logistic function takes a linear predictor and returns a probability. Logistic regression can be performed using the In this example, we try to predict the fate of the passengers aboard the RMS Titanic. Read the data: Clean the missing values: In that case, we replace the missing values by an approximation, the average. Train the model: Summary of the model: The output:
Below the table of coefficients are fit indices, including the null and deviance residuals and the Akaike Information Criterion (AIC), which can be used for comparing model performance. Example of odds ratios: With this model, compared to the first class, the 3rd class passengers have about a tenth of the odds of survival. Example of confidence interval for the parameters: Exemple of calculating the significance of the overall model: The test statistic is distributed chi-squared with degrees of freedom equal to the differences in degrees of freedom between the current and the null model (i.e., the number of predictor variables in the model). The p-value is near 0, showing a strongly significant model. |
Read Article
https://develop.horje.com/learn/1434/reference