Session Ready
Exercise

Correlated variables

In this exercise, you will inspect the dataset with respect to correlated variables. It is important to remove them before applying a binary classifier, especially in the case of logistic regression. When two or more variables are highly correlated you should remove all except for one.

First, we will use the corrplot() function in the corrplot package to visualize the correlations. In the correlation plot, blue represents a positive correlation and red a negative correlation. A darker color indicates a higher correlation. Finally, you will remove the highly correlated variables from the data set.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Load the corrplot package.
  • Generate a correlation matrix, M, using the function cor(). The function takes a subset of the dataset as an argument.
  • Visualize the correlation between the variables using corrplot() and M.