liveBook · Manning

Factoextra

As explained in Statistics Slam Dunk

factoextra is an R package that provides functions for extracting and visualizing multivariate analysis results, including clustering results.

factoextra is an R package for extracting and visualizing multivariate-analysis results, including K-means clustering. It complements built-in clustering functions with practical diagnostic and plotting tools. section 11.1 section 20.1

Use factoextra to:

  • Compare candidate cluster counts with fviz_nbclust() using within-cluster sum of squares or silhouette methods. section 11.5.2
  • Visualize assigned clusters with fviz_cluster() after computing a K-means solution. section 11.5.2
  • Combine diagnostic plots with patchwork for side-by-side or vertically arranged comparisons. section 11.5.2

NBA payroll and wins

For NBA teams, fviz_nbclust() compares possible values of K from payroll and regular-season wins. The within-cluster sum of squares suggests six clusters, while the silhouette method suggests two. Choosing K = 4, fviz_cluster() displays standardized payroll-and-wins groups, including a separate New York Knicks cluster and a larger group containing the San Antonio Spurs. section 11.5.2 section 20.1

library(tidyverse)
library(scales)
library(patchwork)
library(factoextra)

Load factoextra alongside tidyverse, scales, and patchwork before importing and inspecting the data. section 11.1

How Statistics Slam Dunk covers it

How deep it goes
Provides executable cluster-count diagnostics and cluster plots, but leaves clustering computation largely to built-in R functions.
Examples
Uses NBA team payrolls and regular-season wins to compare cluster counts and visualize four standardized clusters.
What it assumes
Assumes basic R package loading and a computed clustering dataset or K-means result.
What you can do after
Apply it via factoextra to evaluate candidate K values and visualize clustering results.
How it connects
Connects K-means clustering with within-cluster sum of squares, silhouette analysis, hierarchical clustering, and patchwork.

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.