Get startedGet started for free

Calculating linkage

Let us revisit the example with three players on a field. The distance matrix between these three players is shown below and is available as the variable dist_players.

From this we can tell that the first group that forms is between players 1 & 2, since they are the closest to one another with a Euclidean distance value of 11.

Now you want to apply the three linkage methods you have learned to determine what the distance of this group is to player 3.

1 2
2 11
3 16 18

This exercise is part of the course

Cluster Analysis in R

View Course

Exercise instructions

  • Calculate the distance from player 3 to the group of players 1 & 2 using the following three linkage methods.
    • Complete: the resulting distance is based on the maximum.
    • Single: the resulting distance is based on the minimum.
    • Average: the resulting distance is based on the average.

Hands-on interactive exercise

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

# Extract the pair distances
distance_1_2 <- dist_players[1]
distance_1_3 <- dist_players[2]
distance_2_3 <- dist_players[3]

# Calculate the complete distance between group 1-2 and 3
complete <- max(c(___, ___))
complete

# Calculate the single distance between group 1-2 and 3
single <- ___
single

# Calculate the average distance between group 1-2 and 3
average <- ___
average
Edit and Run Code