Implicit Assumptions |
---|
◻️ Dependent variable either a factor with 2 levels or numeric with values 0 and 1 only. |
# Sample Data
library(titanic)
- Run the logistic regression model.
fit <- glm(Survived ~ Sex + Age, family = "binomial", titanic_train)
summary(fit)
- If required, perform prediction.
Perform prediction on 1 new observation.
predict(fit, newdata = data.frame(Sex = "male", Age = 35))
Perform prediction on a test set.
predict(fit, newdata = titanic_test)