3个变量的Pearson相关性的类比


17

我对三个变量的“相关性”是否有意义感兴趣,如果是什么,这将是什么?

皮尔逊积矩相关系数

E{(XμX)(YμY)}Var(X)Var(Y)

现在是3个变量的问题:是

E{(XμX)(YμY)(ZμZ)}Var(X)Var(Y)Var(Z)

有什么事吗

在R中似乎可以解释:

> a <- rnorm(100); b <- rnorm(100); c <- rnorm(100)
> mean((a-mean(a)) * (b-mean(b)) * (c-mean(c))) / (sd(a) * sd(b) * sd(c))
[1] -0.3476942

给定固定的第三个变量的值,我们通常查看2个变量之间的相关性。有人可以澄清吗?


2
1)在二元Pearson公式中,如果“ E”(代码中的均值)表示被n除,则st。偏差还必须基于n(而不是n-1)。2)让所有三个变量为同一变量。在这种情况下,我们期望相关性为1(在双变量情况下),但是a ...
ttnphns 2013年

对于三变量正态分布,无论相关性如何,其均为零。
雷·库普曼

1
我真的认为标题会因更改为“ 3个变量的皮尔逊相关分析”或类似内容而受益-这将使此处的链接内容更为丰富
-Silverfish

1
@银鱼我同意!我已经更新了标题,谢谢。
PascalVKooten '18

Answers:


11

确实的东西。为了找出答案,我们需要检查一下我们对关联本身的了解。

  1. 一个矢量值随机变量的相关矩阵X=(X1,X2,,Xp)是方差-协方差矩阵,或简称为“方差”的标准化版本X。也就是说,每个Xi都会替换为最近更新的缩放版本。

  2. Xi的协方差Xj是它们中心版本的乘积的期望。也就是说,写Xi=XiE[Xi]Xj=XjE[Xj],我们有

    Cov(Xi,Xj)=E[XiXj].
  3. 我将写为Var X的方差不是单个数字。它是值Var X i j = Cov X iX j的数组 XVar(X)

    Var(X)ij=Cov(Xi,Xj).
  4. 考虑预期泛化的协方差的方法是将其视为张量。这意味着它是一个完整的量集合,由ij索引,范围从1p,当X进行线性变换时,其值以特别简单的可预测方式改变。具体来说,令Y = Y 1Y 2Y q是由定义的另一个向量值随机变量vijij1pXY=(Y1,Y2,,Yq)

    Yi=j=1paijXj.

    常数Ĵ索引-Ĵ不是功率)形成q×p阵列=一个aijijjq×pj=1pi=1q。期望的线性意味着A=(aij)j=1,,pi=1,,q

    Var(Y)ij=aikajlVar(X)kl.

    用矩阵表示法

    Var(Y)=AVar(X)A.
  5. 由于极化身份所有分量实际上都是单变量方差Var(X)

    4Cov(Xi,Xj)=Var(Xi+Xj)Var(XiXj).

    这告诉我们,如果您了解单变量随机变量的方差,那么您已经了解了双变量变量的协方差:它们是方差的“正好”线性组合。


问题中的表达式完全类似:变量已按照1 进行了标准化。我们可以通过考虑它对任何变量(无论是否标准化)的含义来理解其含义。我们将每个X i替换为其居中版本,如2 )所示,并形成具有三个索引的数量,Xi(1)Xi(2)

μ3(X)ijk=E[XiXjXk].

These are the central (multivariate) moments of degree 3. As in (4), they form a tensor: when Y=AX, then

μ3(Y)ijk=l,m,nailajmaknμ3(X)lmn.

The indexes in this triple sum range over all combinations of integers from 1 through p.

The analog of the Polarization Identity is

24μ3(X)ijk=μ3(Xi+Xj+Xk)μ3(XiXj+Xk)μ3(Xi+XjXk)+μ3(XiXjXk).

μ3μ3(X) as being the multivariate skewness of X. It is a tensor of rank three (that is, with three indices) whose values are linear combinations of the skewnesses of various sums and differences of the Xi. If we were to seek interpretations, then, we would think of these components as measuring in p dimensions whatever the skewness is measuring in one dimension. In many cases,

  • The first moments measure the location of a distribution;

  • The second moments (the variance-covariance matrix) measure its spread;

  • The standardized second moments (the correlations) indicate how the spread varies in p-dimensional space; and

  • The standardized third and fourth moments are taken to measure the shape of a distribution relative to its spread.

To elaborate on what a multidimensional "shape" might mean, observed that we can understand PCA as a mechanism to reduce any multivariate distribution to a standard version located at the origin and equal spreads in all directions. After PCA is performed, then, μ3 would provide the simplest indicators of the multidimensional shape of the distribution. These ideas apply equally well to data as to random variables, because data can always be analyzed in terms of their empirical distribution.


Reference

Alan Stuart & J. Keith Ord, Kendall's Advanced Theory of Statistics Fifth Edition, Volume 1: Distribution Theory; Chapter 3, Moments and Cumulants. Oxford University Press (1987).


Appendix: Proof of the Polarization Identity

Let x1,,xn be algebraic variables. There are 2n ways to add and subtract all n of them. When we raise each of these sums-and-differences to the nth power, pick a suitable sign for each of those results, and add them up, we will get a multiple of x1x2xn.

More formally, let S={1,1}n be the set of all n-tuples of ±1, so that any element sS is a vector s=(s1,s2,,sn) whose coefficients are all ±1. The claim is

(1)2nn!x1x2xn=sSs1s2sn(s1x1+s2x2++snxn)n.

Indeed, the Multinomial Theorem states that the coefficient of the monomial x1i1x2i2xnin (where the ij are nonnegative integers summing to n) in the expansion of any term on the right hand side is

(ni1,i2,,in)s1i1s2i2snin.

In the sum (1), the coefficients involving x1i1 appear in pairs where one of each pair involves the case s1=1, with coefficient proportional to s1 times s1i1, equal to 1, and the other of each pair involves the case s1=1, with coefficient proportional to 1 times (1)i1, equal to (1)i1+1. They cancel in the sum whenever i1+1 is odd. The same argument applies to i2,,in. Consequently, the only monomials that occur with nonzero coefficients must have odd powers of all the xi. The only such monomial is x1x2xn. It appears with coefficient (n1,1,,1)=n! in all 2n terms of the sum. Consequently its coefficient is 2nn!, QED.

We need take only half of each pair associated with x1: that is, we can restrict the right hand side of (1) to the terms with s1=1 and halve the coefficient on the left hand side to 2n1n! . That gives precisely the two versions of the Polarization Identity quoted in this answer for the cases n=2 and n=3: 2212!=4 and 2313!=24.

Of course the Polarization Identity for algebraic variables immediately implies it for random variables: let each xi be a random variable Xi. Take expectations of both sides. The result follows by linearity of expectation.


Well done on explaining so far! Multivariate skewness kind of makes sense. Could you perhaps add an example that would show the importance of this multivariate skewness? Either as an issue in a statistical models, or perhaps more interesting, what real life case would be subject to multivariate skewness :)?
PascalVKooten

3

Hmmm. If we run...

a <- rnorm(100);
b <- rnorm(100);
c <- rnorm(100)
mean((a-mean(a))*(b-mean(b))*(c-mean(c)))/
  (sd(a) * sd(b) * sd(c))

it does seem to center on 0 (I haven't done a real simulation), but as @ttnphns alludes, running this (all variables the same)

a <- rnorm(100)
mean((a-mean(a))*(a-mean(a))*(a-mean(a)))/
  (sd(a) * sd(a) * sd(a))

also seems to center on 0, which certainly makes me wonder what use this could be.


2
The nonsense apparently comes from the fact that sd or variance is a function of squaring, as is covariance. But with 3 variables, cubing occurs in the numerator while denominator remains based on originally squared terms
ttnphns

2
Is that the root of it (pun intended)? Numerator and denominator have the same dimensions and units, which cancel, so that alone doesn't make the measure poorly formed.
Nick Cox

3
@Nick That's right. This is simply one of the multivariate central third moments. It is one component of a rank-three tensor giving the full set of third moments (which is closely related to the order-3 component of the multivariate cumulant generating function). In conjunction with the other components it could be of some use in describing asymmetries (higher-dimensional "skewness") in the distribution. It's not what anyone would call a "correlation," though: almost by definition, a correlation is a second-order property of the standardized variable.
whuber

1

If You need to calculate "correlation" between three or more variables, you could not use Pearson, as in this case it will be different for different order of variables have a look here. If you are interesting in linear dependency, or how well they are fitted by 3D line, you may use PCA, obtain explained variance for first PC, permute your data and find probability, that this value may be to to random reasons. I've discuss something similar here (see Technical details below).

Matlab code

% Simulate our experimental data
x=normrnd(0,1,100,1);
y=2*x.*normrnd(1,0.1,100,1);
z=(-3*x+1.5*y).*normrnd(1,2,100,1);
% perform pca
[loadings, scores,variance]=pca([x,y,z]);
% Observed Explained Variance for first principal component
OEV1=variance(1)/sum(variance)
% perform permutations
permOEV1=[];
for iPermutation=1:1000
    permX=datasample(x,numel(x),'replace',false);
    permY=datasample(y,numel(y),'replace',false);
    permZ=datasample(z,numel(z),'replace',false);
    [loadings, scores,variance]=pca([permX,permY,permZ]);
    permOEV1(end+1)=variance(1)/sum(variance);
end

% Calculate p-value
p_value=sum(permOEV1>=OEV1)/(numel(permOEV1)+1)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.