• Foundation
  • About 22 min
  • 5 practice questions

Karl Pearson's coefficient of correlation

Calculate Karl Pearson's product moment correlation coefficient using deviations from means and using actual values, and interpret its sign and size.

If something looks wrong, please tell us.

By the end of this lesson you can

  • Define covariance and explain how its sign sets the sign of r.
  • Calculate r by the deviations-from-mean method.
  • Calculate r from actual values and interpret the result.

Karl Pearson's coefficient, also called the product moment correlation coefficient or simple correlation coefficient, gives a precise number for the degree of linear relationship between two variables X and Y. It should be used only when the relationship is linear.

Building blocks

Let X̄ and Ȳ be the means, and x = X − X̄, y = Y − Ȳ the deviations from the means. The variance of X is Σx² ÷ N and its standard deviation σx is the positive square root; similarly for Y. The covariance is Cov(X, Y) = Σxy ÷ N. Standard deviations are always positive, so the sign of the covariance decides the sign of r; if the covariance is zero, r is zero.

r = Cov(X, Y) ÷ (σx × σy) = Σxy ÷ (N σx σy) = Σxy ÷ √(Σx² × Σy²), where x = X − X̄ and y = Y − Ȳ.

Working from actual values, an equivalent form is: r = [NΣXY − (ΣX)(ΣY)] ÷ √{[NΣX² − (ΣX)²] × [NΣY² − (ΣY)²]}. All forms give the same answer.

Worked example 1: deviations from means

Illustrative data for five made-up farms: fertiliser X (bags per acre) and yield Y (quintals per acre).

Illustrative data
XYx = X − 6y = Y − 16x²y²xy
213−4−316912
415−2−1412
6140−2040
81822444
102044161616
ΣX = 30ΣY = 8000403434

Step 1, means: X̄ = 30 ÷ 5 = 6; Ȳ = 80 ÷ 5 = 16. Step 2, deviations (columns 3 and 4); check that each column sums to zero. Step 3, totals: Σx² = 40, Σy² = 34, Σxy = 34. Step 4: r = 34 ÷ √(40 × 34) = 34 ÷ √1,360 = 34 ÷ 36.88 = 0.92 (to two decimals). Interpretation: a high positive correlation: farms using more fertiliser tend to get higher yields in this made-up data.

Worked example 2: the same data from actual values

ΣX = 30, ΣY = 80, ΣX² = 4 + 16 + 36 + 64 + 100 = 220, ΣY² = 169 + 225 + 196 + 324 + 400 = 1,314, ΣXY = 26 + 60 + 84 + 144 + 200 = 514, N = 5. Numerator: 5 × 514 − 30 × 80 = 2,570 − 2,400 = 170. Denominator: √[(5 × 220 − 900) × (5 × 1,314 − 6,400)] = √(200 × 170) = √34,000 = 184.39. r = 170 ÷ 184.39 = 0.92. The same answer, which is a useful check.

Worked example 3: a negative correlation

Illustrative: price X (₹ per kg) and quantity demanded Y (kg per day) of a fruit at a made-up stall: (10, 50), (12, 46), (14, 44), (16, 38), (18, 32). Means: X̄ = 70 ÷ 5 = 14; Ȳ = 210 ÷ 5 = 42. Deviations: x = −4, −2, 0, 2, 4; y = 8, 4, 2, −4, −10. Products xy: −32, −8, 0, −8, −40; Σxy = −88. Squares: Σx² = 16 + 4 + 0 + 4 + 16 = 40; Σy² = 64 + 16 + 4 + 16 + 100 = 200. r = −88 ÷ √(40 × 200) = −88 ÷ √8,000 = −88 ÷ 89.44 = −0.98. A very high negative correlation, as demand theory would lead us to expect.

Steps to calculate Karl Pearson's r

  1. Find the means X̄ = ΣX ÷ N, Ȳ = ΣY ÷ N
  2. Deviations x = X − X̄, y = Y − Ȳ (each sums to zero)
  3. Squares and products x², y², xy
  4. Totals Σx², Σy², Σxy
  5. Apply the formula r = Σxy ÷ √(Σx² Σy²)

Interpreting r

Suppose (illustratively) r between marks in English and in Statistics is 0.1: the relationship is positive but weak, and students strong in English may score low in Statistics. If r were 0.9, high marks in one would nearly always go with high marks in the other. For vegetable arrivals and prices, r = −0.9 would mean large arrivals go with much lower prices; r = −0.1 would mean only a slight fall; r = 0 would mean no linear fall at all, which could happen if good transport carried the extra supply to other markets.

Key takeaways: Karl Pearson's r measures the degree of linear relationship. With deviations from means, r = Σxy ÷ √(Σx² Σy²); from actual values, r = [NΣXY − ΣXΣY] ÷ √{[NΣX² − (ΣX)²][NΣY² − (ΣY)²]}. The sign of the covariance gives the sign of r; values near ±1 mean strong, near 0 weak, linear relationships.

Check your understanding

  1. 1. Illustrative: Σxy = 24, Σx² = 36 and Σy² = 25 (deviations from means). Karl Pearson's r is:

    1. 0.67
    2. 0.96
    3. 0.8
    4. 0.027
    Show answer

    Answer: C. r = Σxy ÷ √(Σx² × Σy²) = 24 ÷ √(36 × 25) = 24 ÷ √900 = 24 ÷ 30 = 0.8.

  2. 2. The sign of Karl Pearson's coefficient of correlation is determined by the sign of the:

    1. standard deviation of X
    2. covariance of X and Y
    3. mean of Y
    4. number of observations
    Show answer

    Answer: B. Standard deviations are always positive, so the sign of r = Cov(X, Y) ÷ (σx σy) is the sign of the covariance.

  3. 3. Illustrative: Cov(X, Y) = 6, σx = 3 and σy = 4. The value of r is:

    1. 0.5
    2. 2
    3. 0.25
    4. 72
    Show answer

    Answer: A. r = Cov(X, Y) ÷ (σx σy) = 6 ÷ (3 × 4) = 6 ÷ 12 = 0.5.

  4. 4. Karl Pearson's coefficient should be used only when:

    1. the variables are attributes
    2. the data have no extreme values
    3. the relationship between the variables is linear
    4. the data are ranks
    Show answer

    Answer: C. It measures the degree of linear relationship; for a non-linear relationship it can be misleading.

  5. 5. Assertion (A): If the covariance between X and Y is zero, r is zero. Reason (R): r = Cov(X, Y) ÷ (σx σy), and the standard deviations are positive.

    1. Both A and R are true, and R is the correct explanation of A
    2. Both A and R are true, but R is not the correct explanation of A
    3. A is true, but R is false
    4. A is false, but R is true
    Show answer

    Answer: A. Both are true, and R explains A: dividing zero covariance by a positive product of standard deviations gives r = 0.

Privacy · Terms · Refunds · Delivery