A test of correlation in data with two variables measures how the value of one changes when the value of the second also changes. We can learn the strength of the relationship between the two variables and the direction in which they’re affected.
2024-04-07
A test of correlation in data with two variables measures how the value of one changes when the value of the second also changes. We can learn the strength of the relationship between the two variables and the direction in which they’re affected.
A common way of quantifying the strength and direction of the relationship between two variables is the Pearson Product-Moment Correlation, denoted by r. The values for this correlation range from -1 to 1 where -1 is a perfect negative correlation between the data and 1 is a perfect positive correlation. While the positive and negative sign observe the direction of the correlation, strength is measured by how close the r value is to -/+1.
A positive correlation is any r value greater than zero. Below is an example of a positive correlation that shows as the variable on the x-axis increases, so does the variable on the y axis. Strong positive correlations have r values closer to 1.
A negative correlation is any r value below 0. Below is an example of a negative correlation that shows as the variable on the x-axis increases, the variable on the y-axis decreases and vice versa. Strong negative correlations have r values closer to -1.
The graph of a set of data whose variables have virtually no correlation would look like this. Data with little to no correlation will have r values closer to 0.
To calculate Pearson’s r you need to know the values of the both variables and the sample size (N).
\[ r = \frac{N\sum{xy} - (\sum{x}\sum{y})}{\sqrt{[N \sum{x^2} - (\sum{x})^2][N \sum{y^2} - (\sum{y})^2}]} \]