# Why is correlation only defined between two variables?

I am an MBA student is taking statistics courses.

Our statistics prof was teaching us about correlations in statistics. We learned about Pearson's Correlation of Coefficient which is defined as the correlation between only two variables.

I am asked the prof if the correlation can be calculated between more than two variables and he said "no". But I am struggling to understand why this is the case?

For example: Hurricanes are correlated with Wind Speed, Hurricanes are also correlated with Temperature - Although I am not a meteorologist don't actually know if this is true (I just assumed this to show a point), we can see that in theory more than two variables can be correlated.

Therefore, why do we only evaluate the correlation between two variables and not more than two variables?

• Each pair of variables can be correlated to a different degree. With three variables, there are three possible pairs and you can compute three correlations. You can summarise the three correlations in a single number (eg. all three correlations are different from zero), which loses a lot of information. Sep 16, 2022 at 4:55
• When you have more than two variables, the data type of the correlation changes and it becomes a matrix, the correlation matrix with $r_{ij}=Cor(var_i, var_j)$. There are many methods to further analyse the correlation matrix, and PCA (suggested by dipetkov) is one of them. Sep 16, 2022 at 6:11
• PCA = principal component analysis. Sep 16, 2022 at 14:56
• Very closely related: stats.stackexchange.com/questions/67240.
– whuber
Sep 16, 2022 at 21:58
• @dipetkov to add to that, there can also be interactions between the 3 variables that aren't explained by any pair alone. For instance, if you take the uniform distribution over (x,y,z) in [-1,1]^3 and discard any point where x*y*z is negative, when you take any 2 variables (project onto the xy/xz/yz plane), you just see a uniform [0,1]^2 distribution. Correlation matrices only estimate the pairwise linear relationships between variables Sep 17, 2022 at 7:42

Pearson correlation is defined as a measure of the linear relationship between two variables.

For other relationships, like multidimensional relationships, we use other names. For instance:

In addition there are constructs similar to Pearson correlation that use multiple variables. I have seen on this website before an expression like $$E[(X-\mu_X)(Y-\mu_Y)(Z-\mu_Z)]/(\sigma_X\sigma_Y\sigma_Z)$$. (but I can not find the original post)

• The original post you're looking for is likely this one: stats.stackexchange.com/questions/67240/… Sep 16, 2022 at 21:23
• Both the variance inflation factor and the $R^2$ require picking one variable to play the role of the response Y and the rest -- the role of the inputs X in a model for Y as a function of X. This imposes an interpretation on "multidimensional relationship" that's not implied by the question about "multidimensional correlations" since correlations have the nice property that cor(x,y) = cor(y,x). Sep 18, 2022 at 21:56

In a sense, correlation is defined between more than two variables, through a correlation matrix. This is not a single number of course, but that is only natural given that it is describing correlation between several pairs of variables. This situation is analogous to many types of measurement in multivariate analysis, where we measure aspects of the behaviour by vectors or matrices. You might also be interested to note that the correlation matrix for a set of variables is sufficient to compute the coefficient-of-determination for any Gaussian linear regression involving those variables (see this related answer), so even when we extend our analysis to look at conditional correlations, the correlation matrix is sufficient for this purpose.

Of course, even with a correlation matrix, it is merely describing the pairwise correlation between each pair of variables and resulting linear relationships conditional on other variables. The reason these correlation values are for pairs of variables is that they are measuring the tendency for one thing to vary with respect to a second thing.

why do we only evaluate the correlation between two variables and not more than two variables?

It can be more than 2 variables. Three point correlation function (3PC) is used in cosmology, The Three-Point Correlation Function in Cosmology. It is formed for variables $$x$$, $$y$$ and $$z$$ with the following approximation with a constant factor of 1, $$3PC=Corr(x,y,z) = Corr(x,y) \cdot Corr(y,z) + Corr(y,z) \cdot Corr(z,x) + Corr(z,x) \cdot Corr(x,y)\cdot$$ It is cycling over. This could be extended to N-point correlation function.

Such a statistic would be hard to define and interpret. Say you have the variables $$A$$, $$B$$, and $$C$$. The pairwise correlation between $$A$$ and $$B$$ is close to $$+1$$ and the pairwise correlation between $$B$$ and $$C$$ is close to $$-1$$. What should the single number correlation between the three variables be? High, low, or maybe zero?

You could instead look at correlation matrices between all the variables, but it is a highly overrated approach that could be misleading, and lead to a false sense of understanding. One example is people blindly dropping from their analysis variables that are strongly correlated with each other, or weekly correlated with the dependent variable, missing the point that those relations may change when controlling for other variables. It is like in the parable about the blind men and an elephant:

A group of blind men heard that a strange animal, called an elephant, had been brought to the town, but none of them were aware of its shape and form. Out of curiosity, they said: "We must inspect and know it by touch, of which we are capable". So, they sought it out, and when they found it they groped about it. The first person, whose hand landed on the trunk, said, "This being is like a thick snake". For another one whose hand reached its ear, it seemed like a kind of fan. As for another person, whose hand was upon its leg, said, the elephant is a pillar like a tree-trunk. The blind man who placed his hand upon its side said the elephant, "is a wall". Another who felt its tail, described it as a rope. The last felt its tusk, stating the elephant is that which is hard, smooth and like a spear.

Looking at the pairwise relations tells you only the part of the story but is not enough to get the full picture right. We all hope that our brain would be able to somehow combine all the information for the full picture, but if that was the case that people can just eyeball the numbers to draw legitimate conclusions, we wouldn't need statistics.

For many variables, we use instead the multivariate models like linear regression or partial correlations that tell us about pairwise relations but corrected for the influence of other variables.

• The elephant parable really isn't related at all (and quite bizarre, I'm pretty sure blind people are aware that objects are not symmetric). How about giving a real (or toy) example of a mistaken conclusion that might be drawn from a correlation matrix? Sep 16, 2022 at 17:30
• @Clumsycat for example in the case of confounders you would see correlations that are caused by a common cause, so the individual pairwise correlations would be misleading.
– Tim
Sep 16, 2022 at 17:48
• That holds just as well for a single pairwise correlation. What additional deception is a matrix providing? Sep 17, 2022 at 14:03
• @Clumsycat I edited for a better example.
– Tim
Sep 17, 2022 at 14:20

Correlations between multiple variables can be defined as a joint cumulant. In physics we call this a "connected correlation function". In statistics, one would call these quantities covariances instead of correlations as it's customary to normalize correlations so that they are between -1 and 1.

The connected correlation between $$n$$ variables is an effect that's due to all $$n$$ variables together that cannot be attributed to correlations between variables in proper subsets of the $$n$$ variables. Connected correlation functions are multilinear functions of their arguments.

The expectation value of any arbitrary product of random variables can be written as a sum of products of connected correlations involving all the ways one can partition the set of variables into disjoint subsets. This property yields a recursion for the joint correlation function, so it can be used to define it.

If we denote connected correlations as $$C(X_1,X_2,\ldots,X_n)$$, then we have: $$C(X) = E(X)\tag{1}$$ which follows trivially from the recursion. For two variables $$X$$ and $$Y$$ we have that the connected correlation $$C(X,Y)$$ is the covariance between $$X$$ and $$Y$$. This also follows easily from the recursion: $$E(XY) = C(X,Y) + C(X) C(Y)$$ Using (1) we then get: $$C(X,Y)=E(XY) - E(X) E(Y)\tag{2}$$

For 3 variables $$X$$, $$Y$$ and $$Z$$, the recursion is: $$E(XYZ) = C(X,Y,Z) + C(X,Y) C(Z) + C(X,Z) C(Y)+C(Y,Z) C(X) + C(X)C(Y)C(Z)$$

Substituting the expression (1) and (2) for the connected correlations of one and two variables then yields:

$$C(X,Y,Z)=E(XYZ) - E(XY) E(Z) - E(XZ)E(Y) - E(YZ)E(X) + 2E(X)E(Y)E(Z)$$

• Does $C(X,Y)$ in your formulas not denote the covariane instead of the correlation? Sep 18, 2022 at 6:51
• @cdalitz, I see, I was using physics jargon. Sep 18, 2022 at 8:06

Why is correlation only defined between two variables?

Your professor likely meant Pearson's correlation as presented in the standard material you are required to learn. It is a definition used in the context of conventional (or at least introductory) statistics, and is certainly defined between only two random variables in that context. But let us explore this question beyond your course.

Like many things, there is a tapestry of historical events that will never be fully uncovered. Auguste Bravais was the first person I am aware of to calculate what we would now think of Pearson's correlation on a sample, but to him they were merely cosines of the angles between error vectors. A little later came Francis Galton who laboured on the intuition of "co-relation" and his tabular calculations (he was not a skilled mathematician, purportedly) and was an inspiration to Karl Pearson who developed the formalism we recognize today. Why did these men consider only consider correlation to be between pairs of variables? I don't know. Even more restricting, Francis Galton appears to have only considered positive correlation which may have been due to his interest in biometrics which (by chance) were positively correlated (e.g. height and weight).

Here are my speculations (not to be confused with fact).

• Pairwise comparisons may be more intuitive for many people (though perhaps not all).
• Related to the first point, much of mathematics is riddled with binary operations. While multiary algebras and other fascinating creatures live in the world universal algebras, it is not on most people's radar. People develop tools with what they know about.
• Pearson's correlation interoperates nicely with linear algebra, and linear algebra is itself computationally feasible on modest problems in a pre-PC era. • A computational sea monster awaits those that stray too far from pairwise decomposability: exponential complexity. Once you have posited some multiary function $$f$$, you quickly run into the problem that for $$n$$ possible operands there are $$2^n$$ possible inputs to the function (if you include inputting an empty set of variables, sometimes taken to be $$f(\emptyset)=0$$ or $$f(\emptyset)=1$$ depending on context). Making a number of statistical estimates that grows exponentially with the number of variables quickly gets out of hand, and it can take considerably more effort to think about what selection of subsets of the powerset of variables are needed for your problem.
• The multivariate distribution is often-applicable, and in the context pairwise comparisons are enough. Want a multivariate normal distribution but only have a vector of IID standard normal variables? No problem. Just apply a linear transformation. Plus Isserlis' theorem tells us that the higher mixed moments are either zero or decomposable into pairwise mixed moments. Combine this with Proposition 7.1.3 from Athreya and Lahiri 2006 and you'll realize that correlation tells you everything about statistical dependence of join normal distributions.

To an extent we can also deny the claim that we don't consider correlations of multiple variables, although I will side step the argument about what the word "correlation" ought to denote. As exemplified by other answers here (+1 to all I have seen so far), we actually do consider multiary functions of random variables that might be considered (in some sense) "co-relation". Clearly these functions are different, and thus selecting among them should be informed by what it is you want to quantify.

# Examples

One thing I like to think about is what data sets minimize or maximize such statistics. And one way to do that is to create examples. Let me share some with you.

While the math in many cases is not restricted to three variables, I will keep to three for now just so that 3D scatterplots can be easily utilized. The following were found using gradient-based minimization (RMSProp). I did not check the functions for the existence of local minima, and I only reported the value of the objective to four decimal places.

## Three-Point Correlation

This notion is from msuzen's post, which was new to me (+1).

The minimal data set appears to be 'nearly' a line, but with some jittering. The maximal data set is a line.

## Coskewness

The coskewness is the standardized mixed product moment of three variables. It is a trilinear extension of the bilinear Pearson product-moment correlation coefficient. This notion was explicitly mentioned by Sextus, and is a standardized cumulant of the sort shown by Count. The tensorial aspect is nicely shown by whuber.

Multiple lines stretch out from the centroid into specific octants depending on the signum of $$x_i y_i z_i$$. Reflections $$-x_i y_i z_i$$ are avoided because of the odd symmetry: $$\mathbb{E}[XYZ] = -\mathbb{E}[XYZ] = 0$$. This will always be true for odd mixed moments.

## Partial Correlation

With partial correlation we are computing the correlation between the residuals of $$X$$ as a function of $$Z$$ and the residuals of $$Y$$ as a function of $$Z$$. I noticed Tim also mentioned this statistic. While in some of my own projects I consider the correlations of residuals of non-linear functions to be "partial correlations", it seems this is idiosyncratic to me. So for convention and and clarity, let us use the following linear equations:

$$Y = Z - 2$$ $$X = -3Z + 4$$

Appearances can be deceiving. In both plots the data superficially appear to be spherical blobs, but actually all of the data approximately sits on a plane. Looking colinear to these planes, the data would appear to just follow a line.

## Taylor's Multi-Way Correlation Coefficient

Taylor 2020 suggested the coefficient

$$\operatorname{mcor}[\vec x_1, \cdots, \vec x_n] \triangleq \frac{1}{\sqrt{d}} \sqrt{\frac{1}{d-1} \sum_{i=1}^d (\lambda_i - \bar \lambda)^2}$$

where $$\lambda_i$$ is the $$i$$th eigenvalue of the correlation matrix on $$\vec x_1, \cdots, \vec x_n$$ and $$\bar \lambda$$ is the mean eigenvalue of the same correlation matrix. This approach echos Sextus in considering the eigenvalues of a covariance matrix.

The minimal data set is a spherical cloud of points. The maximal data set is a line.

## Wang-Zheng's Unsigned Correlation Coefficient

Wang & Zheng 2014 proposed

$$\operatorname{UCC}[X_1, \cdots, X_n] \triangleq 1 - \det R_{\vec x \vec x}$$

where $$R_{\vec x \vec x}$$ is the correlation matrix on those variables.

The minimal data set appears to be a spherical cloud of points. The maximal cloud appears to be nearly a plane except for a couple deviating points.

## Coefficient of Multiple Correlation ($$R^2$$)

Sextus mentioned the multiple correlation coefficient. As noted by dipetkov, we must assume something asymmetric: The minimal data set is a spherical point cloud. The maximal is a data set which sits on a plane, and appears somewhat bimodal in distribution.

## Variance Inflation Factor

Sextus mentioned the variance inflation factor. As with multiple correlation, we assume that $$Y$$ is predicted linearly from $$X$$ and $$Z$$: The minimal data set is a spherical point cloud. In the maximal case it isn't really maximal, but rather unbounded. In this unbounded case the data appears to be approaching a distribution similar to what maximized the multiple correlation coefficient, but I stopped before numerical stability collapsed.

## User1865345's Suggestion

User1865345 suggested we consider something of the form:

$$R[X,Y]R[X,Z]$$

Both the minimal and maximal cases are data sets in the form of a line with a little bit of jitter.

• I use some related techniques here: datascience.stackexchange.com/a/114486/135267 Sep 19, 2022 at 1:11
• Another measure that could be added to this list is $R^2$. It measures how well one variable can be predicted by a linear combination of the other variables, and it coincides with the square of the Pearson correlation in the case of two variables. Sep 19, 2022 at 5:27
• @cdalitz It is included as the "coefficient of multiple correlation". I've added a "$R^2$" for those that do not recognize the term. Sep 20, 2022 at 4:20
• That historic trivia? Thanks, @Galen, for the interesting post. +1. Sep 25, 2022 at 8:47

One of the interpretations of Pearson's correlation coefficient is the proportionate reduction of error (PRE): Assume a variable vector $$y$$, about which nothing further is known. Then, if you have to predict a missing $$y_i$$, your best estimator would be the arithmetic mean $$\bar{y}$$, and the error would be $$E_1 = SS_{total} = \sum_{i=1}^n(y_i - \bar{y})^2$$.

Assume now that you have a second data set $$x$$, which can be used to predict $$y$$, in the simplest case (but without limitation of generality) by linear regression $$\hat{y}_i = a + b x_i$$. Then the error becomes $$E_2 = SS_{residual} = \sum_{i=1}^n(y_i - \hat{y}_i)^2$$, and the coefficient of determination (fraction of variability of $$y$$ that is explained by $$x$$) is $$r^2 = \frac{E_1 - E_2}{E_1} = 1 - \frac{E_2}{E_1}$$. The $$R^2$$ mentioned by others is a generalisation of this approach for several explaining variables. There are other correlation coefficients with PRE-interpretation for non-cardinal data (Guttman's λ, Freeman's θ, Wilson's e, the point-biserial correlation, $$\eta^2$$). See Freeman, L.C.: Elementary applied statistics, New York, London, Sidney (John Wiley and Sons) 1965 for a very readable introduction.

Thus, you should think about what PRE is in your particular case to construct a suitable correlation coefficient.