A linear relationship describes variables that change together in a straight-line pattern. With continuous variables, the relationship may be positive, negative, or neutral: positive variables increase together, while negative variables move in opposite directions at constant rates. section 2.5.4
Correlation measures the strength and direction of a linear relationship with a coefficient from -1 to +1. Values near -1 or +1 indicate strong relationships; values near 0 indicate little or no relationship. Correlation does not establish causation. section 2.5.4
A practical R workflow for examining linear relationships is:
- Select only continuous variables before computing correlations, because correlation coefficients are calculated between numeric variables. section 2.5.4
- Visualize the matrix as a ggplot2 heat map, using color and printed coefficients to compare relationships quickly. section 2.5.4
NBA draft variables
A draft-data correlation matrix compares Age, games played (G), minutes played (MP), Win Shares (WS), and Win Shares per 48 minutes (WS48). G and WS correlate at about 0.80, while Age and WS correlate at about -0.25; the heat map makes these differences visible.
Linearity is also a prerequisite for linear modeling. Outliers can change a regression line’s slope and obscure the overall pattern, so diagnostic plots help evaluate whether the model’s linearity assumption is reasonable. section 5.0 section 5.7.5

