liveBook · Manning

Dist() function

As explained in Statistics Slam Dunk

The dist() function in base R computes pairwise distances between observations using a specified distance measure.

Use base R’s dist() function to calculate pairwise distances between observations, supporting hierarchical clustering of NBA draft data. section 3.9

NBA draft distances

distance_matrix <- dist(draft_clust_final, method = "euclidean") print(distance_matrix) For points at picks 1 and 3, the approximate Euclidean distance is 3.36; picks 2 and 3 are 15.43 units apart.

How Statistics Slam Dunk covers it

How deep it goes
Defines the distance matrix and Euclidean calculation, then stops short of explaining alternative distance measures.
Examples
Uses NBA draft-pick numbers, average win shares, Euclidean calculations, a printed distance matrix, and a cluster dendrogram.
What it assumes
Assumes prepared numeric observations and introduces pairwise dissimilarity through coordinate-based Euclidean distance.
What you can do after
Apply it via base R to construct a distance matrix for hierarchical clustering.
How it connects
Connects distance matrix, Euclidean distance, hierarchical clustering, and hclust().

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.