Login
📚 Mostly Harmless Statistics
Chapters ▾
⇩ Download ▾

12.2 Scatterplots

A scatterplot shows the relationship between two quantitative variables measured on the same individuals.

How to Interpret a Scatterplot:

Correlation Coefficient

The sample correlation coefficient measures the direction and strength of the linear relationship between two quantitative variables. There are several different types of correlations. We will be using the Pearson Product Moment Correlation Coefficient (PPMCC). The PPMCC is named after biostatistician Karl Pearson. We will just use the lower-case r for short when we want to find the correlation coefficient, and the Greek letter ρ, pronounced “rho,” (rhymes with sew) when referring to the population correlation coefficient.

Portrait photograph of Karl Pearson.
Karl Pearson

Interpreting the Correlation:

8 sample scatterplots, with correlation values ranging from -1 to 1. Plots form a straight line when r=-1 or r=1, and become more random as r approaches 0.
Figure 12-1: Sample scatterplots with various values of r.

When you have a correlation that is very close to 1 or 1, then the points on the scatter plot will line up in an almost perfect line. The closer r gets to 0, the more scattered your points become.

When r is equal to 1 or 1 all the dots in the scatterplot line up in a straight line. As the points disperse, r gets closer to zero. The correlation tells the direction of a linear relationship only. It does not tell you what the slope of the line is, nor does it recognize nonlinear relationships. For instance, in Figure 12-2, there are three scatterplots overlaid on the same set of axes. All three data sets would have r=1 even though they all have different slopes.

A single set of axes contains 3 different linear scaterplots, of slopes 1, 2, and 0.5, all with r=1.
Figure 12-2: Any straight line has r=1.

For the next example in Figure 12-3, r=0 would indicate no linear relationship; however, there is clearly a non-linear pattern with the data.

A scatterplot whose points are arranged in a parabola. Scatterplot has h=0.
Figure 12-3: A plot of points in a parabola, a non-linear pattern, has r=0.

Figure 12-4 shows a correlation r=0.874, which is pretty close to one, indicating a strong linear relationship. However, there is an outlier, called a leverage point, which is inflating the value of the slope. If you remove the outlier then r=0, and there is no up or down trend to the data.

A scatterplot with r=0.874 consists of 12 data points in a 6-by-2 grid, and a 13th point located significantly higher than and to the right of the grid.
Figure 12-4: A single outlier can significantly change the value of r.

Calculating Correlation

To calculate the correlation coefficient by hand we would use the following formula.

Instead of doing all of these sums by hand we can use the output from summary statistics. Recall that the formula for a variance of a sample is sx2=(xix¯)2n1. If we were to multiply both sides by the degrees of freedom, we would get (xix¯)2=(n1)sx2.

We use these sums of squares (xix¯)2 frequently, so for shorthand we will use the notation SSxx=(xix¯)2. The same would hold true for the y variable; just changing the letter, the variance of y would be sy2=(yiy¯)2n1, therefore SSyy=(n1)sy2.

The numerator of the correlation formula is taking in the horizontal distance of each data point from the mean of the x values, times the vertical distance of each point from the mean of the y values. This is time-consuming to find so we will use an algebraically equivalent formula ((xix¯)(yiy¯))=(xy)n·x¯y¯, and for short we will use the notation SSxy=(xy)n·x¯y¯.

To start each problem, use descriptive statistics to find the sum of squares.

When is a correlation statistically significant? The next subsection shows how to run a hypothesis test for correlations.

Adapted from Mostly Harmless Statistics by Rachel Webb (Portland State University), hosted on LibreTexts (stats.libretexts.org) and licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.