AI summary by TwinMind

StatQuest: Hierarchical Clustering

StatQuest with Josh Starmer

11m 19s

Introduction to Hierarchical Clustering and Heat Maps

  • Hierarchical clustering often associated with heat maps
  • Heat map structure:
    • Columns represent different samples
    • Rows represent measurements from different genes
    • Red signifies high gene expression
    • Blue/purple means lower gene expression
  • Hierarchical clustering orders rows/columns based on similarity
    • Makes correlation patterns visible
    • Comparison shown: heat map without vs with clustering
  • Heat maps often accompanied by dendrograms

Basic Clustering Process - Step-by-Step Example

  • Simple example: 3 samples, 4 genes
  • Step 1: Determine which gene most similar to gene #1
    • Gene 1 vs Gene 2: very different (opposite expression patterns)
    • Gene 1 vs Gene 3: similar (both red in sample 1, both blue in sample 3)
    • Gene 1 vs Gene 4: also similar
    • Gene 1 most similar to Gene 3
  • Step 2: Find gene most similar to Gene 2
    • Gene 2 most similar to Gene 4
  • Step 3: Compare all combinations, find most similar pair
    • Genes 1 and 3 are most similar overall
    • Merge into Cluster #1
  • Step 4: Repeat process treating cluster as single unit
    • Cluster 1 most similar to Gene 4
    • Gene 2 most similar to Gene 4
    • Genes 2 and 4 most similar combination
    • Merge into Cluster #2
  • Final step: Merge remaining two clusters

Dendrograms

  • Visual representation showing:
    • Similarity levels (branch heights)
    • Order of cluster formation
  • Cluster 1 (genes 1,3): formed first, shortest branch (most similar)
  • Cluster 2 (genes 2,4): formed second, second shortest branch
  • Final cluster (all genes): formed last, longest branch

Distance Metrics for Similarity

  • Euclidean distance most commonly used
    • Formula: √[(difference in sample 1)² + (difference in sample 2)²]
    • Example calculation: genes with values 1.6 vs 0.5 and 0.5 vs -1.9
    • Result: √[1.1² + 2.4²] = 3.2
    • Geometric interpretation: hypotenuse of triangle using Pythagorean theorem
    • Extends to more samples by adding more squared differences
  • Manhattan distance alternative
    • Sum of absolute values of differences
    • No squaring/square root operations
    • Geometric interpretation: total length of line segments placed head-to-tail
  • Distance metric choice is arbitrary
    • No biological/physical reason to prefer one
    • Choose based on data insights
  • Visual comparison shows similar but slightly different heat maps

Cluster Comparison Methods

  • Multiple approaches for comparing clusters to other points/clusters:
    • Centroid method: compare to average of cluster measurements
    • Single linkage: compare to closest point in cluster
    • Complete linkage: compare to furthest point in cluster (R hclust default)
  • Different methods produce similar but distinct heat maps
  • Visual examples show data points on XY plane with different linkage approaches

Summary and Best Practices

  • Cluster formation based on similarity notion (user decides)
  • Most programs have reasonable defaults for:
    • Distance metrics
    • Cluster comparison methods
  • Dendrogram branch heights indicate similarity levels
  • Shorter branches = more similar clusters

TwinMind

Get summaries like this for your own meetings

TwinMind takes notes in the background during meetings, lectures, and calls, then writes the summary for you.

Free plan to get started

No bot joins your calls

Phone, desktop & Chrome apps

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome