From that we see that insulin is not a great variable to predict from hence we now create a new model using only the three main variables used i.e Age, Glucode and Skin Thickness. The Model:
logistic_reg <- glm(Outcome ~ Age + Glucose + SkinThickness,
family="binomial", diabetes)
Predicting our outcome
After the model is created, we can now predict using that model. i.e to check whether a person has diabetes or not using the predict function in r.
predicted <- data.frame(probability.of.Outcome=logistic_reg$fitted.values,
Outcome=diabetes$Outcome)