A.1.9 - Correlation in ecological data

A.1.9 - Correlation in ecological data

Ecologists often measure an organism and an environmental factor in the same place. Learn to plot those paired observations, calculate a rank correlation and judge its statistical support. You will also learn why even a convincing association needs further evidence before it can be called a cause.

Paired data and the biological question

A correlation question asks whether two measured variables tend to change together across a set of sampling units.

Correlation

A statistical association between two variables. A positive association means larger values of one tend to accompany larger values of the other; a negative association means larger values tend to accompany smaller values.

Each observation must be a pair: for example, soil water content and grass-shoot count measured in the same quadrat. Keep each pair together during processing. Pairing a moisture reading from one quadrat with a count from another would test an invented relationship.

The biological question determines the statistical test; the presence of a table does not.

Biological questionSuitable approach, when its assumptions are met
Does shoot count tend to change as soil water content changes across paired quadrats?A correlation coefficient for association between two variables.
Do two independently assigned treatments differ in mean seedling height?An appropriate independent-samples t-test for a difference between means, with its distribution and variance assumptions checked.
Do observed offspring colour-category counts fit a specified 3:1 expectation?A chi-squared goodness-of-fit test of observed against expected categorical counts, with suitable expected frequencies.

Spearman's rank correlation is useful when the variables can be ordered and the question concerns a monotonic pattern: as one increases, the other tends consistently to increase, or consistently to decrease. The trend may curve; it need not be a straight line. It does not require the raw variables to be normally distributed. A Pearson correlation of the raw measurements instead describes linear association and has different assumptions for its significance test; it is not needed for the worked question here.

Pairs must be independent of other pairs for the simple test used in this lesson. The two measurements within a pair are deliberately linked. Ten readings of the same quadrat are repeated measurements of one sampling unit, not ten independent quadrats. Neighbouring quadrats can also resemble each other because of shared soil or shade. Plan spatial sampling and justify the unit of replication before choosing the test; random coordinates alone do not guarantee independence.

Plot the observations before calculating

A scatter diagram preserves the actual measurements and can reveal a pattern that a single coefficient would hide.

Consider this original illustrative dataset. It is a mathematical teaching example, not the result of a reported field investigation. Assume that eight randomly selected, well separated grassland patches provide independent sampling units. One 0.25 square metre quadrat is counted in each patch, with soil water content measured for that same quadrat. All counts refer to the same identified grass species and comparable sampling conditions.

PatchSoil water content / %Grass shoots in 0.25 square metres
A124
B159
C187
D2115
E2412
F2720
G3017
H3324

Draw the scatterplot in a notebook before comparing it with panel A below. Put soil water content on the horizontal axis because it is the explanatory variable of interest, and shoot count on the vertical axis. In an observational study these axis choices do not establish that water content causes the count. Label both variables and their units or sampling area. Use regular, readable scales covering every observation; these axes need not start at zero, although panel A uses zero on the count axis.

Plot one point for every pair. For example, patch C is at horizontal coordinate 18% and vertical coordinate 7 shoots. Do not replace the eight observations with one mean or join them in patch-letter order. A carefully justified trend line may help describe a pattern, but no fitted line is needed to calculate Spearman's coefficient.

Two original ecological scatterplots: shoot count mostly increases with soil water content in panel A; seedling count rises and then falls in panel B

Panel A plots every value in the table. Panel B is a separate original illustrative dataset: water contents 10, 20, 30, 40 and 50%, paired with seedling counts 1, 4, 16, 4 and 1 per 0.25 square metres respectively.

Panel A suggests a positive monotonic association, with local reversals such as B to C. Strength concerns how consistently the ranks agree, not how steep the plotted trend looks: changing an axis scale changes the apparent steepness. Check unusual points against records and sampling conditions; do not delete an inconvenient observation merely to increase correlation.

Panel B has a clear non-monotonic pattern: seedlings are most numerous at intermediate water content. Its Spearman coefficient is zero because the increasing and decreasing rank trends cancel. Zero rank correlation therefore does not prove independence or the absence of every kind of relationship. Always inspect the scatterplot, including curved patterns and outliers, before interpreting a coefficient.

Calculate Spearman's coefficient without ties

Ranking replaces each measurement by its position within its own variable, while preserving the original pairs.

For each variable separately, give the smallest value rank 1, the next smallest rank 2, and so on. Use the same direction for both variables. Ranking the largest first in both columns also works; reversing only one column reverses the sign incorrectly. In the eight-patch dataset, every value within each variable is different, so there are no ties.

Let RR be the water-content rank and SS the shoot-count rank. For each patch calculate d=R−Sd=R-S, then square it. The count 9 at patch B is the third smallest shoot count, so its rank is 3 even though B is the second row.

PatchWater rank RRShoot rank SSddd2d^2
A1100
B23−11
C3211
D45−11
E5411
F67−11
G7611
H8800
Total363606

For paired ranks with no ties in either variable:

rs=1−6∑d2n(n2−1)r_s=1-\frac{6\sum d^2}{n(n^2-1)}

Here rsr_s is Spearman's rank correlation coefficient, nn is the number of complete independent pairs and ∑d2\sum d^2 is the sum of squared rank differences. The coefficient is dimensionless.

There are eight pairs, not sixteen independent observations. Substitute n=8n=8 and ∑d2=6\sum d^2=6:

rs=1−6×68(82−1)=1−36504=0.928571…≈0.929.r_s=1-\frac{6\times6}{8(8^2-1)} =1-\frac{36}{504} =0.928571\ldots\approx0.929.

The final subtraction from 1 is essential. A result must lie between −1 and +1. A value of +1 means perfect agreement of the two rank orders; −1 means a perfectly reversed rank order. Here the positive value near +1 describes a strong positive monotonic association in this sample. It does not measure how many extra shoots accompany a 1% water-content increase, because ranking discards the original intervals between measurements.

Use a stated significance rule

A coefficient with a large magnitude needs a test rule before it can support a claim about the population represented by the sampling.

For the eight-patch investigation, set the hypotheses and significance level before looking for a favourable result:

  • Null hypothesis, H0H_0: soil water content and grass-shoot count are independent in the sampled population; the null model predicts no association.
  • Alternative hypothesis, H1H_1: there is a monotonic association between soil water content and grass-shoot count, in either direction.

This is a two-sided test because a sufficiently strong positive or negative rank association counts against the null. A one-sided alternative would predict a stated direction in advance and require its matching critical rule. Do not choose a one-sided test after noticing the direction of the data.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account