Correlation Coefficient
STA1505 - Statistics for Beginners · Correlation and Regression
Correlation Coefficient
The correlation coefficient is a statistical measure that describes the strength and direction of a relationship between two variables. It is represented by the letter 'r'. The value of 'r' ranges from -1 to 1. A value of 1 indicates a perfect positive correlation, -1 indicates a perfect negative correlation, and 0 indicates no correlation.
Understanding Correlation
Correlation occurs when two variables change together. For example, if one variable increases, the other variable may also increase (positive correlation) or decrease (negative correlation). A strong correlation means that the variables have a consistent pattern of change, while a weak correlation means that the changes are less predictable.
Remember: Correlation does not imply causation. This means that just because two variables are correlated, it does not mean that one variable causes the other to change.
Types of Correlation
- Positive Correlation: Both variables increase together. For example, as the temperature increases, ice cream sales tend to increase.
- Negative Correlation: One variable increases while the other decreases. For example, as the amount of exercise increases, body weight may decrease.
- No Correlation: There is no predictable relationship between the variables. For example, the amount of time spent studying may have no correlation with shoe size.
Calculating the Correlation Coefficient
The formula for calculating the Pearson correlation coefficient (r) is:
r = (Σ(x - x̄)(y - ȳ)) / (√(Σ(x - x̄)²) * √(Σ(y - ȳ)²))
Where:
- x and y are the two variables
- x̄ is the mean (average) of x
- ȳ is the mean (average) of y
- Σ denotes the summation symbol, which means to sum over all data points
Step-by-Step Calculation Example
Consider the following data set:
| X (Hours Studied) | Y (Test Score) |
|---|---|
| 1 | 50 |
| 2 | 55 |
| 3 | 65 |
| 4 | 70 |
| 5 | 80 |
1. First, calculate the means of X and Y:
x̄ = (1 + 2 + 3 + 4 + 5) / 5 = 3
ȳ = (50 + 55 + 65 + 70 + 80) / 5 = 64
2. Next, calculate (x - x̄) and (y - ȳ):
| X | Y | (X - x̄) | (Y - ȳ) | (X - x̄)(Y - ȳ) | (X - x̄)² | (Y - ȳ)² |
|---|---|---|---|---|---|---|
| 1 | 50 | -2 | -14 | 28 | 4 | 196 |
| 2 | 55 | -1 | -9 | 9 | 1 | 81 |
| 3 | 65 | 0 | 1 | 0 | 0 | 1 |
| 4 | 70 | 1 | 6 | 6 | 1 | 36 |
| 5 | 80 | 2 | 16 | 32 | 4 | 256 |
3. Now, calculate the sums:
Σ(X - x̄)(Y - ȳ) = 28 + 9 + 0 + 6 + 32 = 75
Σ(X - x̄)² = 4 + 1 + 0 + 1 + 4 = 10
Σ(Y - ȳ)² = 196 + 81 + 1 + 36 + 256 = 570
4. Finally, substitute these values into the correlation coefficient formula:
r = 75 / (√10 * √570)
First, calculate the square roots:
√10 ≈ 3.162, √570 ≈ 23.85
Now, substitute:
r ≈ 75 / (3.162 * 23.85) ≈ 75 / 75.52 ≈ 0.993
This means there is a very strong positive correlation between hours studied and test scores.
Watch out: Ensure you calculate the means correctly. An error in the means will affect the entire calculation of the correlation coefficient.
Interpreting the Correlation Coefficient
The value of the correlation coefficient tells you about the strength and direction of the relationship:
- r = 1: Perfect positive correlation
- 0 < r < 1: Positive correlation (the closer to 1, the stronger the correlation)
- r = 0: No correlation
- -1 < r < 0: Negative correlation (the closer to -1, the stronger the correlation)
- r = -1: Perfect negative correlation
Limitations of the Correlation Coefficient
While the correlation coefficient is useful, it has limitations:
- It only measures linear relationships. If the relationship is non-linear, the correlation coefficient may not accurately reflect the relationship.
- It is sensitive to outliers. An outlier is a data point that is significantly different from others. Outliers can distort the value of r.
- Correlation does not imply causation. Just because two variables are correlated does not mean one causes the other.
Conclusion
The correlation coefficient is a valuable tool for understanding the relationship between two variables. By calculating and interpreting the correlation coefficient, you can gain insights into how variables interact. However, it is important to remember its limitations and use it alongside other statistical methods.
Check your understanding
- What is the range of values for the correlation coefficient?
- Explain the difference between positive and negative correlation.
- What are some limitations of the correlation coefficient?
- Calculate the correlation coefficient for the following data set: X = [2, 4, 6, 8, 10], Y = [3, 5, 7, 9, 11].