Performing logistic regression—an advanced and widely used classification method—could scarcely be easier in R. To fit a logistic regression, we use the familiar glm function. The difference now is that we'll be specifying our own error distribution and link function (the glm calls of last chapter assumed we wanted the regular linear regression error distribution and link function, by default). These are specified in the family argument:
model <- glm(diabetes ~ ., data=PID, family=binomial(logit))
Here, we build a logistic regression using all available predictor variables.
You may also see logistic regressions being performed where the family argument looks like family="binomial" or family=binomial()—it's ...