A simple logistic regression model in R

Let's test our environment setup by building a simple logistic regression model in R. Open RStudio and create a new R Script file. You can create a data frame in R, using the following code:

# Input Datadata <- data.frame(  "X"=c(0, 0.25, 0.5, 1),   "Y"=c(0, 0.5, 0.5, 1),   "output"=c(0, 0, 1, 1))

As you can see from this code snippet, we built a dataframe with columns X, Y, and output. The X column takes values of 0, 0.25, 0.5, and 1. The Y column has values of 0, 0.5, 0.5, and 1. output is a binary class, where it can be either 0 or 1. data looks as follows:

Now that we have the data to train a logistic ...

Get Hands-On Data Science for Marketing 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.