liveBook · Manning

Correlation plot

As explained in Statistics Slam Dunk

A correlation plot is a visualization showing pairwise association measures among variables.

A correlation plot visualizes the relationship between two continuous numeric variables. Its points reveal whether variables move together, move in opposite directions, or show little meaningful association. section 1.2.1

Build and interpret a correlation plot in R by following these steps:

  • Compute the association with base R's cor() function, then map one numeric variable to each axis in ggplot2. section 4.5.3
  • Add geom_point() for the observations and geom_smooth(method = lm, se = FALSE) for a linear regression line without its default confidence interval. section 4.5.3 section 14.4.1
  • Read the coefficient and point pattern together: positive values indicate shared movement, negative values indicate opposite movement, and values near neutrality indicate weak association. section 1.2.1 section 4.5.3

NBA salaries and win shares

For free agents, cor(free_agents$annual_salary, free_agents$win_shares) returns about 0.76. Plot annual_salary against win_shares with geom_point(), label the coefficient, and add a regression line; the result shows a strong positive association. A second example compares points allowed and wins (-0.58) with points scored and wins (0.53) using side-by-side plots. section 4.5.3 section 14.4.1

Figure 1.2 Visualizations of automobile data using the ggplot2 package
CH01_F02_Sutton

Use the automobile visualization figure to compare a correlation plot with a facet plot, bar chart, and histogram. section 1.2.1

How Statistics Slam Dunk covers it

How deep it goes
Explains definitions, coefficients, point layers, regression lines, confidence intervals, and side-by-side comparisons, but not causal inference.
Examples
Uses automobile data, NBA salaries and win shares, deflections and wins, and points scored or allowed versus wins.
What it assumes
Assumes numeric variables and basic R plotting, while defining correlation direction, strength, and visual interpretation during application.
What you can do after
Apply it via base R, ggplot2, and patchwork to calculate, plot, compare, and interpret pairwise associations.
How it connects
Connects correlation coefficients, scatterplots, linear regression, confidence intervals, heat maps, correlation matrices, and exploratory data analysis.

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.