Exploring the explanatory variables

When the response variable is logical, all the points lie on the \(y=0\) and \(y=1\) lines, making it difficult to see what is happening. In the video, until you saw the trend line, it wasn't clear how the explanatory variable was distributed on each line. This can be solved with a histogram of the explanatory variable, grouped by the response.

You will use these histograms to get to know the financial services churn dataset seen in the video.

churn is available as a pandas DataFrame.

This exercise is part of the course

Introduction to Regression with statsmodels in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create the histograms of time_since_last_purchase split by has_churned
sns.____(____)

plt.show()