Tag Archives: corrélations

Correlation with constraints on pairs

An interesting question was posted on http://math.stackexchange.com/726205/…: if one knows the covariances  and , is it possible to infer ? I asked myself a question close to this one a few weeks ago (that I might also relate to a question I asked a long time ago, about possible correlations between three exchange rates, on financial markets). More precisely, if one knows the correlations  and , is it possible to say something about ?

I could not find much details (but maybe I did not look enough in the existing literature). My strategy was to consider the correlation matrix, and to use the fact that a correlation matrix is symmetric, positive semidefinite matrix (also called Gramian matrix, which is a matrix with no negative eigenvalues). given the two correlations, we should consider the function of the third correlation, which indicates whether the smallest eigenvalue is non-negative, or not. Then, I look at the range of the third correlation, to get the minimum and the maximum possible value (I guess we can prove that possible values belongs to some interval). The code to get that is simply

corrminmax=function(r1,r2){
h=function(r3){
R=matrix(c(1,r1,r2,r1,1,r3,r2,r3,1),3,3)
return(min(eigen(R)$values)>0)}
vc=seq(-1,+1,length=1e4+1)
vr=Vectorize(h)(vc)
indx=which(vr==TRUE)
return(vc[range(indx)])
}

Using this code, it is possible to look at the smallest correlation for the third pair, as well as the maximum correlation,

x1=seq(-1,1,by=.1)
x2=seq(-1,1,by=.1)
W=M=matrix(NA,length(x1),length(x2))
for(i in 1:length(x1)){
for(j in 1:length(x2)){
C=corrminmax(x1[i],x2[j])
W[i,j]=C[1]
M[i,j]=C[2]
}}

If we plot those matrices, we get

par(mfrow=c(1,2))
persp(x1,x2,W,zlim=c(-1,1),col="green",
shade=TRUE,theta=-30)
persp(x1,x2,M,zlim=c(-1,1),col="green",
shade=TRUE,theta=-30)

and if we plot the difference, to get the range of the interval we clearly see that the largest range is obtained when the two correlations are null (in that case, any correlation is valid)

Le “cercle des corrélations” en ACP

Tout au long de l’analyse en composantes principales, nous avons parlé du “cercle des corrélations“. Cette notion est fondamentale en ACP, et je voulais insister un peu sur ce point pour le démystifier,

A chaque point-variable, on associe un point dont la coordonnée sur un axe factoriel est une mesure de la corrélation entre cette variable et le facteur. Dans l’espace de dimension p la distance des points-variables à l’origine est égale à 1. Donc par projection sur un plan factoriel les points-variables s’inscrivent dans un cercle de rayon 1 – le cercle des corrélations – et sont d’autant plus proche du bord du cercle que le pointvariable est bien représenté par le plan factoriel, c’est-à-dire que la variable est bien corrélée avec les deux facteurs constituant ce plan.

L’angle entre 2 variables, mesuré par son cosinus, est égal au coefficient de corrélation linéaire entre les 2 variables: cos(angle) = r(X1,X2)

  • si les points sont très proches (angle proche de 0) : cos(angle) = r(X1,X2) = 1 donc X1 et X2 sont très fortement corrélés positivement
  • si a est égal à 90° , cos(angle) = r(X1,X2) = 0 alors pas de corrélation linéaire entre X1 et X2
  • si les points sont opposés, a vaut 180°, cos(angle) = r(X1,X2) = -1 : X1 et X2 sont très fortement corrélés négativement

Attention, on ne peut interpréter que les variables situées au bord du cercle. En effet, seuls ces points là sont “bien” projetés, comme le rappelle le dession ci-dessous,