## 7.2 Cluster analysis

We will first carry out a hierarchical cluster analysis to find the optimal number of clusters. After that, we will carry out a non-hierarchical cluster analysis and request the number of clusters deemed optimal by the hierarchical cluster analysis. The variables that will serve as input to the cluster analysis are the importance ratings of the store attributes.

### 7.2.1 Standardizing or not?

The first step in a cluster analysis is deciding whether to standardize the input variables. Standardizing is not necessary when the input variables are measured on the same scale or when the input variables are the coefficients obtained by a conjoint analysis. In other cases, standardizing is necessary.

In our example, all input variables are measured on the same scale and therefore standardizing is not necessary. If it were necessary, it can easily be done with mutate(newvar = scale(oldvar)).