Session Ready
Exercise

Using the elbow method

In the previous exercise you realized that you needed to transform your mall data before applying K-means clustering. This was due to the fact that there were large differences in the ranges of the individual variables and also that the AnnualIncome variable had a skewed distribution. The data has been preprocessed by applying a logarithmic transformation to AnnualIncome and scaling all variables through standardization. The new mall_scaled dataset is already available in your workspace.

Now you are going to cluster this data via K-means. You will try different values for \(K\) and select the optimal one using the elbow method.

The pre-loaded stats package provides the kmeans() function, which returns an object with all the information you need. Good luck!

Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4
  • Create a numerical vector named ratios by repeating the value 0 ten times. You will use this vector to store the WSS/TSS ratio for each value of \(K\) between 1 and 10 in your elbow analysis.