In this section, you will learn how to use the statsmodels package in Python to conduct regression analysis. For those readers that would like to use R instead of Python, for this exercise, you can skip to the next section. We will start this section by looking at the data more closely, using the pandas and matplotlib packages, and then we will discuss how to build regression models and interpret the results by using the statsmodels library.
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 the link and download the data file in a CSV format. In order to load this data into your Jupyter Notebook, you can run the following code:
import matplotlib.pyplot as plt
import pandas...