liveBook · Manning

Euclidean distance

As explained in Statistics Slam Dunk

Euclidean distance is the straight-line distance between points computed as the square root of the sum of squared coordinate differences.

Euclidean distance measures the straight-line separation between two points. For coordinates (x1, y1) and (x2, y2), square each coordinate difference, add the results, and take the square root. section 3.9

NBA draft example

Using pick number and average win shares, the distance between picks 1 and 3 is sqrt((1 - 3)^2 + (69.6 - 66.9)^2) = 3.36. Comparing picks 2 and 3 gives 15.43, indicating greater dissimilarity. section 3.9

euclidean_distance <- sqrt((1 - 3)^2 + (69.6 - 66.9)^2)
euclidean_distance
## [1] 3.36006

Run the calculation directly in R with the square-root formula, then use dist(..., method = "euclidean") to create a distance matrix for all observations. section 3.9

How Statistics Slam Dunk covers it

How deep it goes
Explains the coordinate formula, works two NBA examples, and applies R distance-matrix computation.
Examples
Uses NBA draft pick number, average win shares, R calculations, and a clustering dendrogram.
What it assumes
Assumes tabular observations with numeric coordinates and teaches the calculation from coordinate differences.
What you can do after
Apply it via base R to calculate pairwise distances and prepare hierarchical clustering.
How it connects
Connects distance matrices with hierarchical clustering and dendrograms.

Also explained in

Compare how 8 books explain Euclidean distance →

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.