In this section, you are going to learn how to use the glm function in R to conduct regression analysis. For those readers that would like to use Python instead of R for this exercise, the step-by-step instructions for Python are in the previous section. We will start this section by analyzing the data more closely, using the dplyr package, and then we will discuss how to build regression models and interpret the results using the glm function.
For this exercise, we will be using one of the publicly available datasets from IBM Watson, which can be found at https://www.ibm.com/communities/analytics/watson-analytics-blog/marketing-customer-value-analysis/. You can follow this link and download the data file in a CSV format. In order to load this data into your RStudio, you can run the following code:
library(dplyr)
library(ggplot2)
# Load data
df <- read...