Perform the following steps to classify the churn data with logistic regression:
- With the specification of family as a binomial, we apply the glm function on the dataset trainset, by using churn as a class label and the rest of the variables as input features:
> fit = glm(churn ~ ., data = trainset, family=binomial)
- Use the summary function to obtain summary information of the built logistic regression model:
> summary(fit)
- Then, we find that the built model contains insignificant variables, which would lead to misclassification. Therefore, we use significant variables only to train the classification model:
> fit ...