Tutorials › Introduction to Statistics › Clusters and Pooled Correlations

Scatterplots and Correlation · Tutorial 239 of 996

Clusters and Pooled Correlations

Learn how to compare within-group and pooled scatterplots and use the group means and within-group variation to explain their correlations.

Beginner 10 min read

What You'll Learn

  • Distinguish a pooled scatterplot from the patterns within its groups.
  • Explain how differences between group means contribute to pooled correlation.
  • Calculate a pooled correlation from grouped paired data.
  • Recognize when pooling strengthens, weakens, or reverses a relationship.
  • Avoid treating a pooled correlation as a summary of every group’s pattern.

Why Grouping Can Change a Correlation

A scatterplot may contain several clusters, such as measurements from different locations, schools, or treatment groups. Looking at all the points together can produce a correlation that is quite different from the correlations suggested by the separate clusters. The reason is that a pooled correlation reflects both the patterns within groups and the positions of the groups relative to one another.

That distinction matters because a single correlation can conceal important structure. Groups with little linear association individually may form a strong pooled pattern if their centers are separated in the same direction. Conversely, a strong pattern within each group may look weak overall—or even point in the opposite direction—if the group centers are arranged differently.

Here, a within-group correlation is the Pearson correlation calculated using the paired observations in one group. A pooled correlation is the Pearson correlation calculated from all paired observations together, without separating them by group. Both describe linear association, but they answer different descriptive questions.

Definition: Suppose paired quantitative observations \((x_i,y_i)\) belong to one of \(G\) nonoverlapping groups. A pooled correlation is the Pearson correlation computed across all \(n\) pairs. A within-group correlation is computed using only the pairs in one group. The pooled calculation combines variation within groups with variation between their group means.

These are descriptive calculations: no probability model or random-sampling assumption is needed to calculate a correlation for the observed data. For a correlation to be defined, the pooled data must have variation in both variables; a within-group correlation is defined only if that group has variation in both variables. As in any scatterplot analysis, the correlation summarizes linear pattern, so the plots should also be examined.

How Within-Group and Between-Group Variation Combine

The decomposition below makes the pooling effect precise. For group \(g\), let \(n_g\) be its number of observations, \(\bar{x}_g\) and \(\bar{y}_g\) its means, and let \(\bar{x}\) and \(\bar{y}\) be the means across all observations. Define the within-group cross-product sum and squared-deviation sums by

$$ S_{xy,g}=\sum_{i\text{ in }g}(x_i-\bar{x}_g)(y_i-\bar{y}_g),\qquad S_{xx,g}=\sum_{i\text{ in }g}(x_i-\bar{x}_g)^2,\qquad S_{yy,g}=\sum_{i\text{ in }g}(y_i-\bar{y}_g)^2. $$

The corresponding pooled quantities use deviations from the overall means. Each can be split into a within-group part and a between-group part:

$$ S_{xy}=\sum_{g=1}^{G}S_{xy,g} +\sum_{g=1}^{G}n_g(\bar{x}_g-\bar{x})(\bar{y}_g-\bar{y}), $$
$$ S_{xx}=\sum_{g=1}^{G}S_{xx,g} +\sum_{g=1}^{G}n_g(\bar{x}_g-\bar{x})^2,\qquad S_{yy}=\sum_{g=1}^{G}S_{yy,g} +\sum_{g=1}^{G}n_g(\bar{y}_g-\bar{y})^2. $$

For example, the cross-product decomposition follows by writing each observation’s deviation from the overall mean as the sum of its deviation from its group mean and its group mean’s deviation from the overall mean:

$$ x_i-\bar{x}=(x_i-\bar{x}_g)+(\bar{x}_g-\bar{x}),\qquad y_i-\bar{y}=(y_i-\bar{y}_g)+(\bar{y}_g-\bar{y}). $$

Multiplying these expressions and summing within group \(g\) gives the within-group cross-product, the between-group term, and two cross terms. The cross terms are zero because deviations from a group mean sum to zero:

$$ \sum_{i\text{ in }g}(x_i-\bar{x}_g)=0,\qquad \sum_{i\text{ in }g}(y_i-\bar{y}_g)=0. $$

Thus the group’s contribution to the pooled cross-product is \(S_{xy,g}+n_g(\bar{x}_g-\bar{x})(\bar{y}_g-\bar{y})\). Summing over groups gives the stated result. The squared-deviation formulas follow by the same expansion with \(x\) paired with itself or \(y\) paired with itself.

The pooled correlation is \(r=S_{xy}/\sqrt{S_{xx}S_{yy}}\). The between-group term in \(S_{xy}\) is positive when group means for \(x\) and \(y\) tend to be high together, and negative when high group means for one tend to accompany low group means for the other. Meanwhile, between-group differences also add to \(S_{xx}\) and \(S_{yy}\), changing the denominator. Therefore, pooled correlation is not generally a simple average of the group correlations.

Worked Example: Groups Create a Strong Pooled Correlation

Consider these hypothetical measurements. Group A contains \((x,y)=(1,1),(1,3),(3,1),(3,3)\). Group B contains \((11,11),(11,13),(13,11),(13,13)\). Within either group, the four points make a square: there is no linear association.

In Group A, \(\bar{x}_A=\bar{y}_A=2\). The deviations in \(x\) are \(-1,-1,1,1\), and the deviations in \(y\) are \(-1,1,-1,1\). Their products sum to \(1-1-1+1=0\), so \(S_{xy,A}=0\). Both squared-deviation sums equal \(4\), giving \(r_A=0/\sqrt{4(4)}=0\). Group B has the same within-group deviations, so \(r_B=0\) as well.

For all eight observations, \(\bar{x}=\bar{y}=7\). Each group mean is five units from the overall mean in both variables, in the same direction. The within-group cross-products sum to zero, and the between-group contribution is

$$ S_{xy}=0+4(2-7)(2-7)+4(12-7)(12-7)=100+100=200. $$

The within-group squared-deviation sums total \(8\) for each variable. For either variable, the between-group contribution is \(4(5^2)+4(5^2)=200\), so \(S_{xx}=S_{yy}=208\). Consequently,

$$ r=\frac{200}{\sqrt{208(208)}}=\frac{200}{208}\approx 0.9615. $$

The pooled data have a strong positive linear association, even though neither group has a within-group linear association. The separation of the group centers creates the overall pattern.

Worked Example: Strong Within-Group Patterns Are Reversed When Pooled

Now consider two hypothetical groups. Group A has \((1,12),(2,14),(3,16)\), and Group B has \((11,2),(12,4),(13,6)\). Within each group, every increase of one unit in \(x\) accompanies an increase of two units in \(y\), so each within-group correlation is \(1\).

The group means are \((\bar{x}_A,\bar{y}_A)=(2,14)\) and \((\bar{x}_B,\bar{y}_B)=(12,4)\). The overall means are \(\bar{x}=7\) and \(\bar{y}=9\). Within each group, the \(x\)-deviations are \(-1,0,1\); the \(y\)-deviations are \(-2,0,2\). Thus each group has \(S_{xy,g}=4\), \(S_{xx,g}=2\), and \(S_{yy,g}=8\).

The within-group cross-products total \(8\). But the between-group contribution is negative:

$$ \sum_g n_g(\bar{x}_g-\bar{x})(\bar{y}_g-\bar{y}) =3(-5)(5)+3(5)(-5)=-150. $$

Therefore \(S_{xy}=8-150=-142\). For \(x\), the within-group squared deviations total \(4\), and the between-group contribution is \(3(25)+3(25)=150\), so \(S_{xx}=154\). For \(y\), these totals are \(16\) and \(150\), so \(S_{yy}=166\). The pooled correlation is

$$ r=\frac{-142}{\sqrt{154(166)}}=\frac{-142}{\sqrt{25564}}\approx -0.8881. $$

The pooled association is strongly negative even though both within-group associations are perfectly positive. The groups’ centers run in the opposite direction from the patterns inside them, and their between-group contribution outweighs the within-group contribution.

Worked Example: Group Separation Weakens a Strong Pattern

Suppose Group A has \((1,1),(2,2),(3,3)\), while Group B has \((11,1),(12,2),(13,3)\). Each group has a perfect positive linear pattern, so \(r_A=r_B=1\). However, the group means are \((2,2)\) and \((12,2)\): their \(x\)-means differ, while their \(y\)-means are equal.

The overall means are \(\bar{x}=7\) and \(\bar{y}=2\). Within each group, \(S_{xy,g}=2\), \(S_{xx,g}=2\), and \(S_{yy,g}=2\). Thus the within-group totals are \(S_{xy}=4\), \(S_{xx}=4\), and \(S_{yy}=4\) before adding between-group terms. The between-group cross-product is zero because both \(y\)-group means equal \(\bar{y}\). The between-group contribution to \(S_{xx}\) is \(3(2-7)^2+3(12-7)^2=150\), while the contribution to \(S_{yy}\) is zero.

The pooled correlation is therefore

$$ r=\frac{4}{\sqrt{154(4)}}=\frac{4}{\sqrt{616}}\approx 0.1612. $$

The pooled pattern is weakly positive, despite a perfect positive pattern in each group. The widely separated \(x\)-means add substantial variation in \(x\) without adding between-group cross-product or variation in \(y\), reducing the pooled correlation.

Reading Grouped Scatterplots Carefully

When a scatterplot shows distinct clusters, inspect both the points within each cluster and the locations of the cluster centers. A useful sequence is to identify the within-group directions, note whether the group means move together or in opposite directions, and then compare those features with the pooled pattern. A pooled correlation alone cannot tell you which component is responsible.

1
Identify the groups.
Use the group labels or visible clusters to decide which paired observations belong together.
2
Inspect each group.
Describe the direction and strength of its linear pattern, using the scatterplot as well as any within-group correlation.
3
Compare the group centers.
Ask whether groups with larger \(x\)-means also have larger \(y\)-means, smaller \(y\)-means, or similar \(y\)-means.
4
Interpret the pooled result.
Explain how within-group patterns and between-group separation contribute to the overall correlation. Do not assume the pooled value represents every group.

The central practical lesson is not that one calculation is always preferable. The pooled correlation describes the full set of observations, while within-group correlations describe patterns among observations in each group. Which description is useful depends on the question being asked. If group identity is important to understanding the data, report or discuss it alongside the pooled result.

Common Mistake: Treating the Pooled Correlation as a Group-Wise Summary

A common error is to say, “The pooled correlation is negative, so the relationship is negative in every group.” The second worked example shows why that reasoning fails: the pooled correlation is about \(-0.8881\), but both groups have correlation \(1\). The pooled sign reflects the combined within-group and between-group contributions, not necessarily the direction in any one group.

The correction is to keep the levels of description separate. State whether a value is pooled or within-group, inspect the grouped scatterplot, and avoid using the pooled value to make claims about patterns that were not calculated within the groups. Similarly, do not assume that similar within-group correlations guarantee a similar pooled correlation: group locations can substantially change the pooled result.

Key takeaway: A pooled correlation combines within-group patterns with differences between group means. Groups can create, weaken, or reverse the overall linear association, so interpret a pooled value in light of the grouped scatterplot.

Check Your Understanding

Answer each question using the distinction between within-group and pooled patterns.

  1. Two groups each have a within-group correlation near zero. Their means for \(x\) and \(y\) are both higher in one group than the other. What can happen to the pooled correlation, and why?
  2. In the second worked example, why is the between-group contribution to \(S_{xy}\) negative?
  3. Can two groups each have a perfect positive correlation while the pooled correlation is negative? Explain how the group centers could produce this outcome.
  4. In the third worked example, why does the difference in group means weaken the pooled correlation without adding a between-group cross-product?
  5. Why is the pooled correlation generally not the arithmetic mean of the within-group correlations?