Performing a logistic regression analysis

In the previous examples, we have discussed how to use fit data into linear model of continuous variables. In addition, we can use the logit model in generalized linear models to predict categorical variables. In this recipe, we will demonstrate how to perform binomial logistic regression to create a classification model that can predict binary responses on a given a set of predictors.

Getting ready

Download the house rental dataset from https://github.com/ywchiu/rcookbook/blob/master/chapter11/customer.csv first, and ensure you have installed R on your operating system.

How to do it…

Perform the following steps to fit a generalized linear regression model with the logit model:

  1. Read customer.csv into an R session: ...

Get R for Data Science Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.