8  Measures of association

In the previous chapters, we examined measures of central tendency, which summarize the location of data, and measures of dispersion, which describe the spread around that location. Together, these tools provided us with a foundation for understanding and summarizing a single dataset. However, in many real-world scenarios, we are interested in understanding the relationships between variables rather than focusing on one variable in isolation.

Measures of association allow us to explore and quantify the connections between two or more variables. For example, does fertilizer use influence crop yield? Is there a relationship between farm size and agricultural income? Do education levels impact the adoption of new farming technologies? By studying association, we can answer such questions and uncover meaningful patterns in data.

In this chapter, we will introduce key measures of association, such as covariance, correlation coefficients, and other related metrics. We will discuss how these measures are calculated, interpreted, and applied to analyse relationships between variables. By the end of this chapter, you will be equipped to assess both the strength and direction of relationships, providing deeper insights into agricultural and social science research.

8.1 Linear and monotonic relationship

Linear relationship

A linear relationship (or linear association) is a statistical term used to describe a straight-line relationship between variables. Linear relationships can be expressed either in a graphical format where the variable plotted on X-Y plane gives a straight line or relation between two variables (consider x and y) can be expressed with an equation of a straight line (y = a + bx) (will be more clear when we discuss regression in Chapter 9).

Monotonic relation

A monotonic relationship between two variables means that as one variable increases, the other tends consistently to increase or consistently to decrease, but not necessarily at a constant rate. In contrast, a linear relationship implies that one variable changes at a constant rate with respect to the other. While all linear relationships are monotonic, not all monotonic relationships are linear. Refer to the illustration Figure 8.1 for a clearer distinction.

(a) Strong positive linear relationship
(b) Strong negative linear relationship
(c) Weak linear relationship
(d) Non-linear relationship
(e) Monotonic relationship
Figure 8.1: Linear and monotonic relationship

8.2 Scatter diagram

Consider two variables x and y, a scatter diagram is used to visually investigate whether there is any relationship between them. This graphical method helps explore whether an association exists between the two variables. If the variables x and y are plotted along the X-axis and Y-axis respectively in the X-Y plane of a graph sheet the resultant diagram of dots is known as scatter diagram. From the scatter diagram we can say whether there is any association between x and y. Figure 8.2 gives the scatter diagram of Example 8.1

Example 8.1 Consider the data on sepal length (x) and sepal width (y) from the Iris dataset, including three species.

Table 8.1: Data on sepal length (x) and sepal width (y) from the Iris dataset, including three species.
Sepal length (x) Sepal width (y)
5.1 3.5
4.9 3
4.7 3.2
4.6 3.1
5 3.6
7 3.2
6.4 3.2
6.9 3.1
5.5 2.3
6.5 2.8
6.3 3.3
5.8 2.7
7.1 3
6.3 2.9
6.5 3
Figure 8.2: Scatter diagram of data in Example 8.1

Example 8.2 A research station investigates the relationship between the average daily soil moisture content (as influenced by irrigation levels, in percentage) and the corresponding monetary yield (in Rs.) of a crop. The data collected over different periods are as follows:

Table 8.2: Model data on crop yield influenced by soil moisture
Soil moisture (%) Crop yield (in Rs./cent)
14.2 215
16.4 325
11.9 185
15.2 332
18.5 406
22.1 522
19.4 412
25.1 614
23.4 544
18.1 421
22.6 445
17.2 408

Scatter diagram for this example is given in Figure 8.3. You can see a linear association between the two variables i.e. between soil moisture and crop yield in rupees. It can be shown using a line as in Figure 8.4. It is clear that as soil moisture percentage increases crop yield in rupees increases, indicating a positive correlation.

Figure 8.3: Scatter diagram of data in Example 8.2
Figure 8.4: Linear relationship between variables

From the examples above it is clear that scatter diagram gives an idea on linear association between variables, so it can also be used as a graphical tool to see whether any association is present or not. But we cannot quantify the association using scatter diagram.

8.3 Correlation

Correlation is a statistical technique used to examine the relationship between two or more variables. It quantifies the degree and strength of the linear association between two variables, expressed as a single numerical value.

This measure allows us to summarize the extent to which changes in one variable are associated with changes in another. When two or more quantities vary in a related manner, such that movements in one variable are consistently accompanied by movements in the other, the variables are said to be correlated. Based on the nature of relationship, correlation can be classified into three categories positive correlation, negative correlation and no correlation.

Positive correlation

Positive correlation refers to a relationship between two variables in which both move in the same direction. A positive correlation exists when an increase in one variable is accompanied by an increase in the other, or when a decrease in one variable corresponds with a decrease in the other.

Examples of positive correlation:

  1. Fertilizer use and crop yield: Within a responsive dose range, greater fertilizer use may be associated with higher yield. The relationship can level off or reverse at excessive doses.

  2. Rainfall and crop growth: Increased rainfall (x) often leads to better crop growth (y).

  3. Farm size and agricultural output: Larger farm sizes (x) are associated with greater total agricultural output (y).

  4. Labor hours and harvest quantity: The more hours spent harvesting (x), the higher the quantity of crops harvested (y).

Negative correlation

Negative correlation refers to a relationship between two variables in which one variable increases as the other decreases, and vice versa.

Examples of negative correlation:

  1. Weed density and crop yield: As the density of weeds in a field (x) increases, the crop yield (y) decreases. Here, as x increases, y decreases.

  2. Soil salinity and plant growth: Higher soil salinity levels (x) result in reduced plant growth (y).

  3. Age of livestock and milk production: Beyond peak productive age, older animals may have lower milk production. The full age-yield relationship need not be linear or decreasing throughout life.

  4. Pesticide application and pest population: As the amount of pesticide applied (x) increases, the pest population (y) decreases. Here, x increases while y decreases.

No linear correlation means that Pearson’s population coefficient is zero, when defined. A nonlinear association can still be present. A scatter diagram helps distinguish these cases.

Direction of correlation can be identified using a scatter diagram as shown below in Figure 8.5

Figure 8.5: Scatter plot and nature of relationship

8.4 Correlation types

Simple and multiple

In simple correlation the relationship is confined to two variables only. In multiple correlation the relationship between more than two variables is studied.

Linear and non-linear correlation

Linear correlation: A type of correlation in which the relationship between two variables can be represented by a straight line. In this case, a change in one variable corresponds to a proportional change in the other, either in a positive or negative direction.

Non-linear correlation: A type of correlation where the relationship between two variables cannot be represented by a straight line. Instead, the relationship follows a curved pattern, indicating that the variables do not change at a constant rate relative to each other. This is also referred to as curvilinear correlation.

Partial and total correlation

Partial correlation: In multiple correlation analysis, partial correlation examines the relationship between two variables after controlling for or eliminating the linear effect of other correlated variables.

Unadjusted (simple) correlation: This describes the relationship between two variables without controlling for other variables. Some elementary texts call this total correlation; here it is distinguished from partial correlation. The term also has a different specialised meaning in information theory.

Partial and multiple correlation are discussed in detail in Section 8.8.

ImportantNote

Perfect Correlation: If there is any change in the value of one variable, the value of the other variable is changed in a fixed proportion then the correlation between them is said to be in perfect correlation. If there is a perfect correlation, the points will lie in the straight line. If there was a perfect correlation the data will look like in Figure 8.6 below.

Figure 8.6: Perfect correlation

8.5 Measuring correlation

While a scatter diagram provides a visual representation to examine whether there is an association between two variables, it does not give a precise measure of the strength or direction of the relationship. To understand the degree and nature of the correlation more quantitatively, we use numerical measures. In this section, we discuss various methods to quantify correlation, enabling a more comprehensive and objective analysis of the relationship between variables.

8.5.1 Karl Pearson’s coefficient of correlation

It is the most important and widely used measure of correlation. A measure of the intensity or degree of linear relationship between two variables is developed by Karl Pearson, a British Biometrician - known as the Pearson’s correlation coefficient denoted by ‘r’ which is expressed as the ratio of the covariance to the product of the standard deviations of the two variables.

Covariance

Covariance is a measure of the joint linear variability of the two variables. Covariance of two variables x and y is denoted as cov(x, y). Covariance measure is used to find correlation coefficient. Consider two variables x and y with n observations each, then covariance is given by Equation 8.1

\[cov(x,y)=\frac{1}{n}\sum_{i = 1}^{n}{\left( x_{i} - \overline{x} \right)\left( y_{i} - \overline{y} \right)} \tag{8.1}\]

When covariance is zero, there is no linear association, but a nonlinear relationship may remain. The unit of covariance is the product of the units of the two variables.

Pearson’s correlation coefficient

Assumptions of Pearson’s correlation coefficient

Pearson’s correlation can be computed for paired numerical observations with nonzero variances without assuming normality. It summarises linear association and is sensitive to outliers, so inspect a scatter diagram. Independence of observational pairs and suitable sampling are needed for the usual inference. The exact t-test for zero population correlation assumes a bivariate normal population; separate marginal normality alone is not sufficient. Spearman’s correlation, discussed in Section 8.5.2, instead summarises monotonic association using ranks.

The Pearson’s correlation coefficient between the two variables (x and y) is calculated using Equation 8.2. Equation 8.2 can be also written as in Equation 8.3

\[r=\frac{cov(x,y)}{sd(x)sd(y)} \tag{8.2}\]

Here the covariance and both standard deviations must use the same divisor. In this chapter the descriptive covariance and standard deviations use \(n\). Using \(n-1\) in all three gives the same correlation. Do not combine a covariance using \(n\) with sample standard deviations using \(n-1\).

\[ r=\frac{\sum_{i=1}^n(x_i-\bar{x})(y_i-\bar{y})} {\sqrt{\sum_{i=1}^n(x_i-\bar{x})^2}\sqrt{\sum_{i=1}^n(y_i-\bar{y})^2}} \tag{8.3}\]

ImportantNote

Product-moment correlation

Karl Pearson’s correlation coefficient (r) is also called the product-moment correlation coefficient because it is calculated using the product of the deviations of the two variables from their respective means. In other words, the Equation 8.3 involves multiplying the deviations of each data point from the mean of its variable and then averaging those products. The term product-moment refers to the multiplication (product) of the deviations (moments) of the variables from their means.

A simplified formula for by hand computation of correlation coefficient can be derived by modifying Equation 8.3

\[r=\frac{n\sum x_i y_i-(\sum x_i)(\sum y_i)}{\sqrt{\left[n\sum x_i^2-(\sum x_i)^2\right]\left[n\sum y_i^2-(\sum y_i)^2\right]}} \tag{8.4}\]

Properties of the correlation coefficient (r)

  1. It is unit-free and unchanged by shifts of origin and positive changes of scale. Multiplying one variable by a negative constant reverses its sign; multiplying both by negative constants preserves its sign.

  2. It always lies between −1 and +1 (absolute value cannot exceed unity).i.e. −1 ≤ r ≤ +1

  3. r = +1, indicates perfect positive correlation. r = −1, indicates perfect negative correlation. r = 0 indicates no linear correlation.

  4. When the correlation is zero then there is no linear relationship between the variables.

  5. Karl Pearson’s correlation coefficient is also called as product-moment correlation coefficient.

  6. Independent variables with finite, positive variances have zero population correlation. The converse is false: uncorrelated variables can have a nonlinear relationship. A sample correlation can differ from zero even when the underlying variables are independent.

ImportantNote

Spurious correlation

When we calculate the correlation between two variables, we often get a numerical value that quantifies the strength and direction of the relationship between them. However, if there is no actual meaningful relationship between these variables, the correlation value obtained may be misleading. For example, even if there’s no practical or causal link, we might find a correlation between variables like “fertilizer price” and “Kohli’s batting average.” Despite the absence of any real-world connection between these two variables, we can still compute a correlation value. Such a correlation may arise by chance, from a common time trend, or because a third variable influences both measurements. An association can be real without being causal.

Example 8.3 Consider the Table 8.2 in Example 8.2; find correlation coefficient (r)

Solution

Table 8.3: Calculation of Pearson’s correlation coefficient for Table 8.2
Sl. No. Moisture \((x_i)\) Crop yield \((y_i)\) \(x_{i}-\overline{x}\)(1) \(y_{i}-\overline{y}\)(2) (1).(2) \((x_{i}-\overline{x})^{2}\) \((y_{i}-\overline{y})^{2}\)
1 14.2 215 -4.48 -187.42 838.69 20.03 35125.01
2 16.4 325 -2.28 -77.42 176.12 5.18 5993.34
3 11.9 185 -6.78 -217.42 1473 45.90 47270.01
4 15.2 332 -3.48 -70.42 244.70 12.08 4958.51
5 18.5 406 -0.18 3.58 -0.63 0.03 12.84
6 22.1 522 3.43 119.58 409.57 11.73 14300.17
7 19.4 412 0.73 9.58 6.95 0.53 91.84
8 25.1 614 6.43 211.58 1359.42 41.28 44767.51
9 23.4 544 4.73 141.58 668.98 22.33 20045.84
10 18.1 421 -0.58 18.58 -10.69 0.33 345.34
11 22.6 445 3.93 42.58 167.14 15.41 1813.34
12 17.2 408 -1.48 5.58 -8.24 2.18 31.17
Total 224.1 4829 0 0 5325.03 176.98 174754.9

Displayed deviations and products are rounded; totals and final calculations use unrounded values.

n =12

\[mean,\overline{x} = \ \frac{224.1}{12} = 18.68\]

\[mean,\overline{y} = \ \frac{4829}{12} = 402.42\] cov (x,y) = \(\frac{1}{n}\sum_{i = 1}^{n}{\left( x_{i} - \overline{x} \right)\left( y_{i} - \overline{y} \right)}\)

\(\sum_{i = 1}^{12}{\left( x_{i} - \overline{x} \right)\left( y_{i} - \overline{y} \right)} = 5325.03\)

Cov (x,y) = \(\frac{5325.03}{12} = 443.75\)

\[Standard\ deviation,\ S.D\left( x \right) = \ \sqrt{\frac{1}{n}\sum_{i = 1}^{n}\left( x_{i} - \overline{x} \right)^{2}} = \sqrt{\frac{176.98}{12}} = 3.84\]

\[Standard\ deviation,\ S.D\left( y \right) = \ \sqrt{\frac{1}{n}\sum_{i = 1}^{n}\left( y_{i} - \overline{y} \right)^{2}} = \sqrt{\frac{174754.9}{12}} = 120.68\]

Using Equation 8.2, \(r = \frac{443.75}{3.84\ \times 120.68} = 0.96\), which indicates a strong positive correlation

8.5.2 Spearman’s rank order correlation coefficient

The Spearman’s correlation coefficient evaluates the strength and direction of a monotonic relationship between two variables, whether they are continuous or ordinal. In this chapter Spearman’s sample coefficient is denoted by \(\rho\) (rho), a notation also used in some texts. It is often written \(r_s\) to distinguish it from a population correlation. The range of Spearman’s rank correlation also lies between −1 and +1 always, i.e. −1 ≤ ρ ≤+1

Unlike Pearson’s correlation, which measures linear relationships, Spearman’s correlation is based on the ranked values of the variables rather than their raw data. This makes it particularly useful in situations where:

  • The relationship between variables is non-linear but monotonic.

  • The data contains outliers or is not normally distributed, as ranking reduces the influence of extreme values.

  • Variables are measured on an ordinal, interval, or ratio scale.

Spearman’s correlation is useful when a rank-based summary of monotonic association is appropriate; it is not a test of the same feature as Pearson’s linear correlation.

There are two cases in calculating \(\rho\) :

  1. No tied rank case

  2. Tied rank case

No tied rank case

When all the observations in both series are distinct, that is, no value is repeated, the ranks assigned to them are also all distinct, and this is called the no tied rank case. The formula for the Spearman rank correlation coefficient when there are no tied ranks is:

\[\rho = 1 - \frac{6\sum_{i = 1}^{n}d_{i}^{2}}{n\left( n^{2} - 1 \right)} \tag{8.5}\]

where \(d_{i}\) is the difference between ranks of ith pair of observation

Example 8.4 Calculation of Spearman’s rank correlation when there is no tied rank is explained step by step by using the simple example below

The scores for nine students in physics and mathematics are as follows:

Physics: 35, 23, 47, 17, 10, 43, 9, 6, 28

Mathematics: 30, 33, 45, 23, 8, 49, 12, 4, 31

Compute the student’s ranks in the two subjects and compute the Spearman rank correlation.

Table 8.4: Non tied rank case example dataset
Physics Mathematics
35 30
23 33
47 45
17 23
10 8
43 49
9 12
6 4
28 31

Solution

Step 1: Find the ranks for each individual subject. Rank the scores from greatest to smallest; assign the rank 1 to the highest score, 2 to the next highest and so on:

Table 8.5: Ranks assigned for the non-tied rank case
Physics (x) Rankx Mathematics (y) Ranky
35 3 30 5
23 5 33 3
47 1 45 2
17 6 23 6
10 7 8 8
43 2 49 1
9 8 12 7
6 9 4 9
28 4 31 4

Step 2: Add a column d, to your data. The d is the difference between ranks.

d = Rankx - Ranky

For example, the first student’s physics rank is 3 and math rank is 5, so the difference is -2. In the next column, square your d values.

Table 8.6: Rank differences and squared differences for the non-tied rank case
Physics (x) Rankx Mathematics (y) Ranky d d2
35 3 30 5 -2 4
23 5 33 3 2 4
47 1 45 2 -1 1
17 6 23 6 0 0
10 7 8 8 -1 1
43 2 49 1 1 1
9 8 12 7 1 1
6 9 4 9 0 0
28 4 31 4 0 0
Total 12

Step 3: Sum (add up) all of your d2 values. \(\sum_{i = 1}^{n}d_{i}^{2} =\) 4 + 4 + 1 + 0 + 1 + 1 + 1 + 0 + 0 = 12.

Step 4: Insert the values into Equation 8.5

\[\rho = 1 - \frac{6 \times 12}{9\left( 81 - 1 \right)} = 0.90\]

The Spearman’s rank correlation for this set of data is 0.90. This indicates there is a high correlation between the marks of physics and mathematics in the sample.

Tied rank case
When values are tied, assign each tied observation its average rank. Spearman’s coefficient is Pearson’s correlation of these ranks. With \(S_0=n(n^2-1)/12\), an equivalent formula is

\[\rho=\frac{2S_0-T_x-T_y-\sum d_i^2}{2\sqrt{(S_0-T_x)(S_0-T_y)}} \tag{8.6}\]

If there are m individuals tied (having same rank), and s such sets of ranks are there in X- series then, \[T_{x} = \ \frac{1}{12}\sum_{i = 1}^{s}{m_{i}\left( m_{i}^{2} - 1 \right)} \tag{8.7}\]

If there are w individuals tied (having same rank), and s’ such sets of ranks are there in Y- series then, \[T_{y} = \ \frac{1}{12}\sum_{i = 1}^{s'}{w_{i}\left( w_{i}^{2} - 1 \right)} \tag{8.8}\]

Calculation of Spearman’s rank correlation when there is tied rank is explained step by step by using the example below

Example 8.5 The scores for nine students in physics and mathematics are as follows:

Table 8.7: Tied rank case example dataset
Physics (x) Mathematics (y)
35 30
23 33
47 45
23 23
10 8
43 49
9 12
6 33
28 33

Solution

Step 1: Consider the marks in Physics, ranked as usual without considering the repeated value. Here you can see 23 is repeated but first value is given rank 5 and second repeated value is given the next rank 6.

Table 8.8: Initial ranks assigned to physics scores, before averaging tied ranks
Physics (x) Rank
35 3
23 5
47 1
23 6
10 7
43 2
9 8
6 9
28 4

Then the average of two ranks 5 and 6 is assigned to both the values; \(\left( \frac{5 + 6}{2}\right)\) = 5.5

Table 8.9: Physics ranks after averaging the tied rank
Physics (x) Rank
35 3
23 5.5
47 1
23 5.5
10 7
43 2
9 8
6 9
28 4

Similarly for marks in mathematics you can see 33 is repeated thrice.

Table 8.10: Initial ranks assigned to mathematics scores, before averaging tied ranks
Mathematics (y) Rank
30 6
33 3
45 2
23 7
8 9
49 1
12 8
33 4
33 5

You can see the value 33 is repeated thrice, so the average of three ranks 3, 4 and 5 is given \(\left( \frac{3 + 4 + 5}{3} \right)\) = 4

Table 8.11: Mathematics ranks after averaging the tied ranks
Mathematics (y) Rank
30 6
33 4
45 2
23 7
8 9
49 1
12 8
33 4
33 4

Step 2: Calculate \(T_{x}\) and \(T_{y}\)

In our example marks in Physics (x) there are two 23 values tied therefore m = 2; since only one such a set is there s = 1. Applying these values in Equation 8.7 \(T_{x} = \frac{1}{12}\left[ 2 \times (2^{2} - 1) \right] = 0.5\)

In our example marks in Mathematics (y) there are three 33 values tied therefore w = 3; since only one such a set is there s = 1. Applying these values in Equation 8.8 \(T_{y} = \frac{1}{12}\left[ 3 \times (3^{2} - 1) \right] = 2\)

Step 3: Calculate d and then use Equation 8.6

Table 8.12: Rank differences and squared differences for the tied rank case
Physics (x) Rank Mathematics (y) Rank d d2
35 3 30 6 -3 9
23 5.5 33 4 1.5 2.25
47 1 45 2 -1 1
23 5.5 23 7 -1.5 2.25
10 7 8 9 -2 4
43 2 49 1 1 1
9 8 12 8 0 0
6 9 33 4 5 25
28 4 33 4 0 0
Total 0 44.5

Using Equation 8.6, \(S_0=9(9^2-1)/12=60\). Hence \(\rho=(120-0.5-2-44.5)/(2\sqrt{59.5\times58})=0.6213\).

A Spearman rank correlation of 0.6213 indicates a moderately strong positive monotonic relationship between the two variables.

ImportantNote

Spearman’s rank correlation measures monotonic association using ranks and is useful for ordinal data. Pearson’s coefficient measures linear association using the numerical observations. Normality is not required merely to calculate either coefficient; the assumptions of a test or confidence interval must be considered separately. Neither coefficient establishes causation.

8.5.3 Kendall’s coefficient of concordance

Kendall’s coefficient of concordance, denoted by \(W\), measures agreement among several rankings. It ranges from 0 to 1, with 1 indicating identical rankings. It is distinct from Kendall’s \(\tau\), a rank correlation between two variables that ranges from \(-1\) to \(+1\).

When there are multiple sets of rankings (k sets), Kendall’s coefficient of concordance can be used to assess the association among them. This measure is particularly useful in evaluating the reliability or consistency of scores assigned by multiple judges or raters. By quantifying the agreement across different rankings, it provides a robust way to analyse consensus in subjective evaluations or repeated assessments.

To calculate Kendall’s coefficient of concordance, arrange the data with one row per object and one column per judge. Each column contains that judge’s ranks of the same \(n\) objects.

For k judges, there will be k sets of rankings for each object. The table should look like this:

Table 8.13: Model table for the calculation of Kendall’s \(W\)
Object Judge 1 Judge 2 … Judge k
1 R11 R12 … R1k
2 R21 R22 … R2k
… … … … …
n Rn1 Rn2 … Rnk

In Table 8.13 each row represents the ranks assigned to an object by all (k) judges. Each column represents the ranks for each object assigned by a particular judge. \(R_{ij}\) is the rank assigned to the ith object by the jth judge, where i = 1, 2, …, n and j = 1, 2, …, k.

Kendall’s coefficient of concordance (\(W\)) is calculated using Equation 8.9.

\[W=\frac{12\left[\sum_{i=1}^n R_i^2-(\sum_{i=1}^n R_i)^2/n\right]}{k^2 n(n^2-1)} \tag{8.9}\]

This formula assumes that each judge assigns ranks without ties. With tied ranks, use average ranks and the corresponding tie correction; do not apply the untied denominator unchanged.

where \(R_{i} =\sum_{j = 1}^{k}{R_{ij}}\), i.e. the sum of ranks obtained by each object. Calculation of Kendall’s \(W\) is explained in Example 8.6

Example 8.6 In a crop production competition, 10 entries of farmers were ranked by agricultural scientists (judges). Find the degree of agreement among the scientist for the competition result given below.

Table 8.14: Rankings of 10 farmers by agricultural scientists
Farmers Scientist 1 Scientist 2 Scientist 3 Scientist 4
1 4 5 3 7
2 10 9 8 6
3 8 6 10 9
4 3 4 2 1
5 1 3 4 2
6 2 1 1 4
7 5 7 6 5
8 6 2 5 3
9 7 8 9 10
10 9 10 7 8

Solution

Table 8.15: Calculation of Kendall’s \(W\)
Farmers S1 S2 S3 S4 \(R _{i}\) (sum of ranks) \(R _ {i} ^ {2}\)
1 4 5 3 7 19 361
2 10 9 8 6 33 1089
3 8 6 10 9 33 1089
4 3 4 2 1 10 100
5 1 3 4 2 10 100
6 2 1 1 4 8 64
7 5 7 6 5 23 529
8 6 2 5 3 16 256
9 7 8 9 10 34 1156
10 9 10 7 8 34 1156
Total 220 5900

here k = number of judges = 4; n = number of farmers = 10; \(\left(\sum_{i = 1}^{10}R_{i}\right)^{2}\) = (220)2 = 48400; \(\sum_{i = 1}^{10}R_{i}^{2}\) = 5900. Using Equation 8.9

\[W = \frac{12\left\lbrack 5900 - \frac{48400}{10} \right\rbrack}{16 \times 10\left( 100 - 1 \right)} = 0.80\]

A coefficient of concordance of 0.80 suggests that the judges’ rankings are highly consistent. This level of concordance implies that the rankings are strongly aligned, indicating a high level of agreement across the judges’ evaluations.

8.6 Correlation matrix

A correlation matrix is a table that displays the correlation coefficients between multiple variables. It is particularly useful for presenting the correlation values of several variables at the same time. The matrix can be computed using either Pearson’s correlation or Spearman’s correlation. Each cell in the matrix represents the correlation coefficient between the two variables at the intersecting row and column. These values range from -1 to 1. For nonconstant variables with defined correlations, the diagonal elements are equal to 1, as a variable is perfectly correlated with itself. Additionally, the matrix is symmetrical across the diagonal, since the correlation between x and y is the same as the correlation between y and x.

Example 8.7 Data below gives the measurement on several plant growth characters. Create a correlation matrix.

Solution

Table 8.16: Plant growth characters
Growth Water Sunlight Fertilizer Nutrient
4.37 167.55 11.08 56.60 243.43
9.56 325.36 6.71 40.68 519.04
7.59 231.40 5.65 35.86 455.06
6.39 209.62 14.49 78.06 342.38
2.40 77.79 14.66 81.01 127.70
2.40 115.16 13.08 70.34 148.98
1.52 76.76 8.05 45.48 92.12
8.80 280.54 5.98 34.18 532.97
6.41 195.48 11.84 59.45 401.31
7.37 236.65 9.40 48.08 431.84
1.19 51.96 6.22 31.41 146.65
9.73 328.38 9.95 56.11 566.87
8.49 286.58 5.34 29.84 443.16
2.91 131.66 14.09 75.54 234.76
2.64 102.81 7.59 47.03 185.93

Correlation matrix for Table 8.16 can be created as shown in Table 8.17 below. Here the diagonal elements are 1 because correlation of any variable to itself is 1. Also from the matrix below it is easy to find the correlation between any two variables, for example correlation between growth and water is 0.988. Correlation matrix is an effective way of presenting correlation results of several variables.

Table 8.17: Correlation matrix of data in Table 8.16
Growth Water Sunlight Fertilizer Nutrient
Growth 1 0.988 -0.343 -0.332 0.983
Water 0.988 1 -0.328 -0.314 0.967
Sunlight -0.343 -0.328 1 0.986 -0.371
Fertilizer -0.332 -0.314 0.986 1 -0.366
Nutrient 0.983 0.967 -0.371 -0.366 1

8.7 Correlogram

A correlogram is a graphical representation of a correlation matrix. It is used to visualize the pairwise correlation coefficients between multiple variables in a dataset. The correlogram uses colour and size to represent the strength and direction of the correlation, helping to quickly identify relationships among variables. The most common way to display a correlogram is through a matrix of circles or squares, where each shape represents the correlation between two variables. Correlogram can be drawn using packages like corrplot (Wei and Simko 2021) in R software (Team 2024). Different colours and styles are available to make the presentation attractive. Correlation matrix and correlogram can also be generated using our online platform available at www.kaugrapes.com (Pratheesh P. Gopinath 2020).

Correlogram of growth characters in Example 8.7

Testing a population correlation is different from calculating a sample coefficient. The usual t-test for a zero Pearson population correlation is developed in Section 15.4.

8.8 Partial and multiple correlation

Simple correlation describes the association between two variables without adjusting for other variables. Sometimes a third measured variable is associated with both of them. Partial correlation describes the linear association remaining after adjusting both variables for that third variable.

For example, let \(Y\) be crop yield, \(X\) be fertilizer use and \(Z\) be rainfall. The first-order partial correlation between yield and fertilizer use, controlling for rainfall, is

\[ r_{YX\cdot Z}= \frac{r_{YX}-r_{YZ}r_{XZ}} {\sqrt{(1-r_{YZ}^{2})(1-r_{XZ}^{2})}}. \]

The denominator must be nonzero. Equivalently, regress \(Y\) on \(Z\) and \(X\) on \(Z\), and correlate the two sets of residuals. The coefficient lies between \(-1\) and \(1\). Adjustment describes a conditional linear association; it does not by itself establish a causal fertilizer effect.

Multiple correlation describes how closely one response is associated with a linear prediction based on two or more predictors. In ordinary least-squares regression with an intercept, the multiple correlation coefficient \(R\) is the nonnegative square root of the coefficient of determination \(R^2\):

\[R=\sqrt{1-\frac{SS_{\mathrm{error}}}{SS_{\mathrm{total}}}}.\]

For a nonconstant response, \(0\leq R\leq1\). Unlike a simple correlation, \(R\) does not give a positive or negative direction for an individual predictor. That direction is described by its regression coefficient. For example, \(R^2=0.64\) gives \(R=0.80\): the fitted model accounts for 64% of the observed response variation around its mean. This is an in-sample description, not a guarantee of prediction accuracy for new observations.

8.9 Chapter Summary

Fill in the blanks

Answers are given at the end of the chapter.

  1. The strength and direction of linear association are measured by Pearson’s __________ coefficient.

  2. A plot of paired observations used to examine association is called a __________ diagram.

  3. Variables that tend to increase together have __________ correlation.

  4. Variables that tend to move in opposite directions have __________ correlation.

  5. The lowest possible value of Pearson’s correlation coefficient is __________.

  6. The highest possible value of Pearson’s correlation coefficient is __________.

  7. A zero Pearson correlation indicates the absence of __________ association.

  8. Spearman’s correlation is calculated from the __________ of observations.

  9. Spearman’s correlation measures the strength of a __________ relationship.

  10. Tied observations are usually assigned their __________ rank.

  11. Correlation between two variables after controlling for other variables is called __________ correlation.

  12. The association of one variable with a set of other variables is measured by __________ correlation.

  13. Agreement among several sets of rankings can be measured by Kendall’s coefficient of __________.

  14. A table of correlations among several variables is called a correlation __________.

  15. Correlation alone does not establish __________.

Short-answer questions

  1. Define measures of association and explain their importance.

  2. What is a linear relationship?

  3. What is a monotonic relationship?

  4. Distinguish between linear and monotonic relationships.

  5. What is a scatter diagram? Explain its uses.

  6. Explain positive, negative, and no correlation.

  7. Explain the different types of correlation based on the number of variables.

  8. Distinguish between simple and multiple correlation.

  9. Distinguish between linear and non-linear correlation.

  10. What is partial correlation?

  11. What is total correlation?

  12. What is perfect correlation? Explain its characteristics.

  13. Define covariance and explain its interpretation.

  14. Define Pearson’s correlation coefficient.

  15. State the assumptions of Pearson’s correlation coefficient.

  16. Explain the interpretation of the sign and magnitude of Pearson’s correlation coefficient.

  17. Why is Pearson’s correlation coefficient called product-moment correlation?

  18. What are the limitations of Pearson’s correlation coefficient?

  19. Define Spearman’s rank correlation coefficient.

  20. When is Spearman’s rank correlation preferred over Pearson’s correlation?

  21. Explain the calculation of Spearman’s rank correlation when there are no tied ranks.

  22. Explain the calculation of Spearman’s rank correlation when tied ranks are present.

  23. What are tied ranks? How are tied observations assigned ranks?

  24. Define Kendall’s coefficient of concordance.

  25. Explain the use of Kendall’s coefficient of concordance.

  26. What is a correlation matrix? Explain its important properties.

  27. What is a correlogram? Explain its use.

  28. Distinguish between Pearson’s correlation and Spearman’s rank correlation.

  29. Distinguish between correlation and covariance.

  30. Explain the difference between correlation matrix and correlogram.

Numerical and conceptual questions

Answers are given at the end of the chapter.

  1. Draw a scatter diagram for the paired observations in Table 8.2 and identify whether the relationship is positive, negative, or absent.

  2. Explain whether a strong monotonic relationship must always be linear.

  3. Calculate the covariance for the following paired observations:

\(x\) \(y\)
2 5
4 7
6 9
8 11
10 13
  1. Calculate Pearson’s correlation coefficient for the following data:
\(x\) \(y\)
2 4
4 8
6 12
8 16
10 20
  1. If Pearson’s correlation coefficient is \(r=0.85\), interpret the result.

  2. If Pearson’s correlation coefficient is \(r=-0.72\), interpret the result.

  3. If \(r=0\), what can be concluded about the linear relationship between the variables?

  4. If \(r=1\), what does it indicate?

  5. If \(r=-1\), what does it indicate?

  6. Calculate Spearman’s rank correlation coefficient for the following data:

Physics: 35, 23, 47, 17, 10, 43, 9, 6, 28

Mathematics: 30, 33, 45, 23, 8, 49, 12, 4, 31

  1. For the data in Question 10, calculate the rank differences and verify that \(\sum d_i^2=12\).

  2. Calculate Spearman’s rank correlation coefficient when \(\sum d_i^2=12\) and \(n=9\).

  3. Interpret a Spearman rank correlation coefficient of \(\rho=0.90\).

  4. Calculate Spearman’s rank correlation for the tied data in Table 8.7 using the correction terms \(T_x\) and \(T_y\).

  5. If two observations in the \(X\) series are tied, calculate the correction term \(T_x\).

  6. If three observations in the \(Y\) series are tied, calculate the correction term \(T_y\).

  7. Interpret a Spearman rank correlation coefficient of \(\rho=0.61\).

  8. Using the rankings in Table 8.14, calculate Kendall’s coefficient of concordance for the four scientists.

  9. If Kendall’s coefficient of concordance is \(W=0.80\), interpret the result.

  10. Construct the Pearson correlation matrix for the observations in Table 8.16.

  11. Explain why the diagonal elements of a correlation matrix are equal to 1.

  12. Explain why a correlation matrix is symmetrical.

  13. Interpret the following correlation coefficients: \(0.988\), \(-0.343\), and \(0.986\).

  14. Distinguish between a strong correlation and a weak correlation using a scatter diagram.

Important formulae

Covariance:

\[ cov(x,y)=\frac{1}{n}\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y}) \]

Pearson’s correlation coefficient:

\[ r=\frac{cov(x,y)}{sd(x)sd(y)} \]

Pearson’s correlation coefficient using deviations:

\[ r= \frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})} {\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2\sum_{i=1}^{n}(y_i-\bar{y})^2}} \]

Spearman’s rank correlation coefficient without tied ranks:

\[ \rho=1-\frac{6\sum_{i=1}^{n}d_i^2}{n(n^2-1)} \]

where \(d_i\) is the difference between the ranks of the \(i\)th pair of observations.

Spearman’s rank correlation coefficient with tied ranks:

\[ \rho=\frac{2S_0-T_x-T_y-\sum d_i^2}{2\sqrt{(S_0-T_x)(S_0-T_y)}},\quad S_0=\frac{n(n^2-1)}{12} \]

Correction for tied ranks in \(X\):

\[ T_x=\frac{1}{12}\sum_{i=1}^{s}m_i(m_i^2-1) \]

Correction for tied ranks in \(Y\):

\[ T_y=\frac{1}{12}\sum_{i=1}^{s'}w_i(w_i^2-1) \]

Kendall’s coefficient of concordance:

\[ W= \frac{12\left[\sum_{i=1}^{n}R_i^2-\frac{\left(\sum_{i=1}^{n}R_i\right)^2}{n}\right]} {k^2n(n^2-1)} \]

where \(R_i\) is the sum of ranks obtained by the \(i\)th object and \(k\) is the number of judges.

Quick revision

  • Measures of association → describe relationships between variables.
  • Linear relationship → relationship that can be represented by a straight line.
  • Monotonic relationship → one variable consistently increases or consistently decreases as the other increases, but not necessarily at a constant rate.
  • Scatter diagram → graphical method for examining association between two variables.
  • Positive correlation → both variables tend to move in the same direction.
  • Negative correlation → variables tend to move in opposite directions.
  • No correlation → no systematic linear association.
  • Simple correlation → relationship between two variables.
  • Multiple correlation → relationship involving more than two variables.
  • Linear correlation → relationship represented by a straight line.
  • Non-linear correlation → relationship represented by a curved pattern.
  • Partial correlation → relationship between two variables after controlling other variables.
  • Perfect correlation → all points lie on a straight line.
  • Pearson’s correlation → measures linear association.
  • Pearson’s \(r\) ranges from \(-1\) to \(+1\).
  • \(r=+1\) → perfect positive correlation.
  • \(r=-1\) → perfect negative correlation.
  • \(r=0\) → no linear correlation.
  • Covariance → measures joint linear variability.
  • Covariance depends on the units of measurement.
  • Pearson’s correlation is unit-free.
  • Pearson’s correlation is sensitive to outliers.
  • Pearson’s correlation summarises linear association; a nonlinear pattern can make it misleading as a general measure of association.
  • Spearman’s \(\rho\) → rank-based measure of monotonic association.
  • Spearman’s correlation is useful for ordinal data and non-linear monotonic relationships.
  • Spearman’s correlation ranges from \(-1\) to \(+1\).
  • No tied ranks → use the basic Spearman formula.
  • Tied ranks → use average ranks and correction terms.
  • Kendall’s coefficient of concordance → measures agreement among multiple rankings.
  • Correlation matrix → table of pairwise correlation coefficients.
  • Diagonal elements of a correlation matrix → 1.
  • Correlation matrix → symmetrical about the diagonal.
  • Correlogram → graphical representation of a correlation matrix.
  • Strong positive correlation → coefficient close to \(+1\).
  • Strong negative correlation → coefficient close to \(-1\).
  • Correlation measures association, not necessarily causation.

Answers to fill in the blanks

1. Correlation 2. Scatter 3. Positive 4. Negative 5. \(-1\) 6. \(+1\) 7. Linear 8. Ranks 9. Monotonic 10. Average 11. Partial 12. Multiple 13. Concordance 14. Matrix 15. Causation

Solutions to numerical and conceptual questions

  1. Plot each pair \((x_i,y_i)\) on the \(X\)-\(Y\) plane: points rising left to right indicate positive correlation, points falling left to right indicate negative correlation, and points with no systematic pattern indicate no correlation.

  2. No. A monotonic relationship only requires one variable to increase consistently or decrease consistently as the other increases, at a possibly varying rate; so all linear relationships are monotonic, but not all monotonic relationships are linear.

  3. Using Equation 8.1, \(\bar{x}=6\), \(\bar{y}=9\), \(\sum(x_i-\bar{x})(y_i-\bar{y})=40\), so \(cov(x,y)=\frac{40}{5}=8\).

  4. Here \(y=2x\), so all points lie on a straight line with positive slope; using Equation 8.4, \(r=+1\) (perfect positive correlation).

  5. \(r=0.85\) is positive and close to \(+1\), indicating a strong positive linear relationship.

  6. \(r=-0.72\) is negative and fairly close to \(-1\), indicating a strong negative linear relationship.

  7. \(r=0\) means there is no linear correlation; a nonlinear relationship may still exist.

  8. \(r=1\) indicates perfect positive linear correlation; all points lie on a straight line with positive slope.

  9. \(r=-1\) indicates perfect negative linear correlation; all points lie on a straight line with negative slope.

  10. Using Equation 8.5 with \(\sum d_i^2=12\) and \(n=9\), \(\rho=1-\frac{6(12)}{9(81-1)}=0.90\), a high positive monotonic relationship.

  11. The rank differences are \(d=-2,2,-1,0,-1,1,1,0,0\), so \(d^2=4,4,1,0,1,1,1,0,0\) and \(\sum d_i^2=12\).

  12. Using Equation 8.5 with \(\sum d_i^2=12\) and \(n=9\), \(\rho=1-\frac{6(12)}{9(81-1)}=0.90\).

  13. \(\rho=0.90\) indicates a high positive monotonic relationship between the two variables.

  14. For Table 8.7, \(S_0=60\), \(T_x=0.5\), \(T_y=2\) and \(\sum d_i^2=44.5\). Applying Equation 8.6 gives \(\rho=73/(2\sqrt{59.5\times58})=0.6213\).

  15. Using Equation 8.7 with \(m=2\), \(T_x=\frac{1}{12}[2(2^2-1)]=0.5\).

  16. Using Equation 8.8 with \(w=3\), \(T_y=\frac{1}{12}[3(3^2-1)]=2\).

  17. \(\rho=0.61\) indicates a moderately strong positive monotonic relationship.

  18. Using Equation 8.9 with \(k=4\), \(n=10\), \(\sum R_i=220\) and \(\sum R_i^2=5900\), \(W=\frac{12\left[5900-\frac{220^2}{10}\right]}{4^2(10)(99)}=0.80\).

  19. A coefficient of concordance of \(W=0.80\) indicates a high degree of agreement among the judges’ rankings.

  20. Calculating each pairwise Pearson coefficient from Table 8.16 gives the matrix in Table 8.17. The ten distinct off-diagonal coefficients, read across the upper triangle, are 0.988, -0.343, -0.332, 0.983, -0.328, -0.314, 0.967, 0.986, -0.371 and -0.366 (rounded to three decimals).

  21. For nonconstant variables, the diagonal elements equal 1 because every variable is perfectly correlated with itself, \(r(X,X)=1\).

  22. A correlation matrix is symmetrical because \(r(X,Y)=r(Y,X)\), so the entries above and below the diagonal are equal.

  23. \(r=0.988\) is a very strong positive correlation, \(r=-0.343\) a weak to moderate negative correlation, and \(r=0.986\) a very strong positive correlation.

  24. A strong correlation shows points clustering closely around a straight line, whereas a weak correlation shows points more widely scattered with a less clearly defined pattern.

CautionHistorical Insights

Correlation and Sir Francis Galton

The concept of correlation dates back to Sir Francis Galton, who introduced the idea of “co-relation” in the 19th century while studying the relationship between physical traits, such as the height of parents and their children. Karl Pearson further developed this idea by formalizing the calculation of correlation and introducing the formula we use today in terms of Pearson’s correlation coefficient. Pearson’s work in the late 1800s provided a mathematical framework for understanding the strength and direction of relationships between two variables, a concept that has since become fundamental in statistics, especially in the fields of genetics, psychology, and social sciences.

TipQuotes to Inspire

“Statistics is like a high-caliber weapon: helpful when used correctly and potentially disastrous in the wrong hands.”
- Charles Wheelan, Naked Statistics (2013) (Wheelan 2013)