1 Study Overview

This report uses hierarchical cluster analysis to group survey respondents with similar grocery shopping and customer service responses. Comparing these groups can help a business decide which products and marketing messages may appeal to different customers.

1.1 Objectives

  • Import and review the survey data.
  • Standardize the survey variables before clustering.
  • Create a dendrogram and divide respondents into three clusters.
  • Compare cluster sizes, means, and medians.
  • Explain how the results could support customer targeting.

1.2 Dataset

The analysis uses customer_segmentation.csv. The first column, ID, identifies each respondent and is excluded from the clustering calculations.

Table 1. Dataset overview
Measure Value
Respondents 22
Survey variables 14
Missing survey responses 0

2 Cluster Analysis

2.1 Method

The survey variables are standardized to have a mean of zero and a standard deviation of one. This analysis follows the supplied lab’s two distance calculations and uses complete-linkage hierarchical clustering. The resulting tree is divided into three clusters for the lab exercise. As in the supplied code, all numeric columns except ID are included. Some columns are coded demographic categories, so this is a reproduction of the classroom method; interpreting category codes as numerical distances is a limitation.

2.2 Dendrogram

Each branch represents respondents or groups of respondents joined during clustering. The rectangles show the three groups used in this report. Respondent labels are hidden to keep the figure readable.

Figure 1. Hierarchical clustering dendrogram with three clusters.

Figure 1. Hierarchical clustering dendrogram with three clusters.

2.3 Cluster Sizes

Table 2. Respondents in each cluster
Cluster Respondents Percentage
Cluster 1 17 77.3%
Cluster 2 2 9.1%
Cluster 3 3 13.6%
Figure 2. Number of respondents in each cluster.

Figure 2. Number of respondents in each cluster.

3 Comparing Cluster Profiles

The tables below use the original survey ratings so the cluster averages and medians are easier to interpret. Variable names match the dataset. The meaning of higher and lower ratings depends on the original questionnaire’s coding. Means and medians of category codes, especially Gender, should not be treated as numerical measurements.

3.1 Average Ratings

Table 3. Mean survey ratings by cluster
Variable Cluster 1 Cluster 2 Cluster 3
CS_helpful 1.29 3.0 2.33
Recommend 1.12 2.5 1.67
Come_again 1.24 1.5 2.67
All_Products 1.82 3.0 3.00
Profesionalism 1.24 1.5 2.33
Limitation 1.35 2.0 2.00
Online_grocery 2.24 3.0 2.00
delivery 2.24 3.0 3.00
Pick_up 2.71 2.5 1.00
Find_items 1.29 2.0 2.00
other_shops 2.65 1.5 3.00
Gender 1.18 1.0 2.00
Age 2.41 2.5 2.67
Education 3.12 5.0 2.33

3.2 Median Ratings

Table 4. Median survey ratings by cluster
Variable Cluster 1 Cluster 2 Cluster 3
CS_helpful 1 3.0 2
Recommend 1 2.5 1
Come_again 1 1.5 3
All_Products 2 3.0 3
Profesionalism 1 1.5 2
Limitation 1 2.0 1
Online_grocery 2 3.0 2
delivery 2 3.0 3
Pick_up 3 2.5 1
Find_items 1 2.0 2
other_shops 2 1.5 3
Gender 1 1.0 2
Age 2 2.5 2
Education 2 5.0 2

3.3 Demographic Category Counts

Counts describe the coded demographic categories more appropriately than averages. The original survey labels are needed to identify what each code represents.

3.3.1 Gender

Code Cluster 1 Cluster 2 Cluster 3
1 14 2 0
2 3 0 3

3.3.2 Age

Code Cluster 1 Cluster 2 Cluster 3
2 12 1 2
3 3 1 0
4 2 0 1

3.3.3 Education

Code Cluster 1 Cluster 2 Cluster 3
1 3 0 0
2 6 0 2
3 1 0 1
5 7 2 0

4 Discussion Questions

4.1 1. How many observations are in each cluster?

Answer: Cluster 1 has 17 observations, Cluster 2 has 2 observations, and Cluster 3 has 3 observations. There are 22 observations total, with most respondents belonging to Cluster 1.

4.2 2. Why compare the means or medians?

Answer: Looking at the means or medians helps us understand what makes each group different. The cluster numbers alone do not explain much about the customers. Comparing their ratings shows which features received higher or lower scores in each group. Businesses can use these differences to create promotions and choose products that better match each group’s preferences.

4.3 3. Should we use the mean or median?

Answer: I would use medians to describe the typical response for ordered survey ratings, and means as an additional way to compare the groups. Before interpreting either one, I would check what the response codes mean. For a category like Gender, I would use counts and percentages instead of a mean or median because the numbers are category labels.

4.4 4. Which summary measures help describe and target each cluster?

Answer: I would look at each cluster’s size, percentage of respondents, and the means and medians of its survey ratings. I would use counts and percentages for demographic categories. For example, the average CS_helpful score is 1.29 in Cluster 1, 3.00 in Cluster 2, and 2.33 in Cluster 3. These differences could help identify groups with different customer service experiences, but I would check the response labels before deciding whether a higher score means a better experience. The groups are also small: Clusters 2 and 3 contain only two and three respondents, so I would treat targeting ideas as preliminary.

4.5 5. How do K-means and hierarchical clustering differ?

Answer: K-means requires us to choose the number of clusters before running the analysis. It groups observations around cluster centers and updates the assignments to reduce differences within each group. Hierarchical clustering starts with each observation in its own group and gradually combines similar groups. It creates a dendrogram that we can cut to get different numbers of clusters. I prefer hierarchical clustering for this assignment because the dendrogram makes it easier for me to see how the groups form.

4.6 6. What job titles relate to cluster analysis?

Answer: Using “cluster analysis” on Indeed, I found at least three relevant job titles: Research Analyst, Research and Data Science Fellow, and Market Research & Analysis Manager. These positions show that analytical skills can apply to several career paths, including research and marketing. This is a sample of the titles found, rather than a count of every available position.

4.7 7. Optional: Should the aggregate function include respondent IDs?

Answer: We should use mydata[,-1] because it removes the first column, which contains respondent IDs. An ID identifies a person but does not describe their preferences. Calculating an average or median ID would not help us understand the clusters. Removing it keeps the results focused on the survey responses.

5 Exported Results

Knitting this report also creates these files in the report folder:

  • clusterID.csv: respondent IDs and cluster assignments.
  • cluster_means.csv: mean ratings for each cluster.
  • cluster_medians.csv: median ratings for each cluster.

6 References

James, G., Witten, D., Hastie, T., & Tibshirani, R. (2013). An introduction to statistical learning: With applications in R. Springer.

Xu, Z. (2020). Using hierarchical clustering & PCA for market segmentation and targeting [Course lab instructions].

Course K-means tutorial

Indeed search: Cluster analysis

Logan Sparks on Bluesky