SOP: Computing the Correlation Coefficient and Testing Its Significance
GIFSQ — Global Institute for Food Safety & Quality
Principle
While the regression equation describes the form of the statistical dependence of y on x, the correlation coefficient r measures the degree or intensity of the linear relationship. Its values lie between +1 (perfect positive correlation) and −1 (perfect negative correlation); r = 0 means the two factors are unrelated. The square r² gives the proportion of the total variability in one variate accounted for by variation in the other. The significance of r is tested against tabulated correlation coefficients for (n − 2) degrees of freedom.
Materials
- The n pairs of observations (x, y)
- The corrected sum of products, corrected sum of squares for x and corrected sum of squares for y (as computed for the regression equation)
- The book’s table of correlation coefficients at the 5% and 1% significance levels
Procedure
Compute the corrected sum of products and the corrected sums of squares for x and y
↓
Compute the correlation coefficient r using the expression below
↓
Square r to obtain r² and interpret it as the proportion of the variability of y explained by x
↓
Take the degrees of freedom as (n − 2) and refer r to the correlation-coefficient table; if the calculated r equals or exceeds the tabulated value at the chosen level, the correlation is significant
Calculation
r = (corrected sum of products) / √[(corrected sum of squares for x)(corrected sum of squares for y)]
Where,
- r = sample correlation coefficient
- The correlation coefficient has (n − 2) degrees of freedom
Worked example — total solids vs weight-by-length ratio of French beans
From the regression computations: corrected sum of products = 1.0542; corrected SS for x = 0.366; corrected SS for y = 17.7161 (as printed in this section).
r = 1.0542 / √(0.366 × 17.7161) = 1.0542/2.5464 = 0.414
r² = (0.414)² = 0.171, so that 17.1% of the variation in the total solids content can be explained as completely associated with the variation in the w/l ratio of French beans, and 82.9% is the residual variation independent of the w/l ratio.
The example has 34 pairs of observations, so the degrees of freedom are 34 − 2 = 32. By reference to the book’s table, the value of 0.414 with 32 df is significant at the 5% level.
Note: the corrected sum of squares for y is printed as 17.7961 (Σy² = 2285.6250) in the regression section but as 17.7161 (Σy² = 2285.5450) in this section — a 0.08 difference in the printed Σy²; each value is carried as printed in its own section, and r = 0.414 recomputes with this section’s value.
Precautions
- In some cases r² is more readily interpretable than r, since it is the proportion of the total variability in one variate accounted for by variation in the other.
References
Ranganna, S., Handbook of Analysis and Quality Control for Fruit and Vegetable Products, 2nd edition.