# What is the correlation function in multivariable/vectoral case?

I know that the correlation function between random variables $X$ and $Y$ is defined as

$$\rho_{X,Y}=\mathrm{corr}(X,Y)={\mathrm{cov}(X,Y) \over \sigma_X \sigma_Y} ={E[(X-\mu_X)(Y-\mu_Y)] \over \sigma_X\sigma_Y}.$$

What does happen when $\mathbf{X}$ and $\mathbf{Y}$ are random vectors?

$$\mathbf{X} = \begin{bmatrix} X_1 \\ X_2 \\ \vdots \\ X_n \end{bmatrix}, \quad \quad \mathbf{Y} = \begin{bmatrix} Y_1 \\ Y_2 \\ \vdots \\ Y_n \end{bmatrix}$$

How is the correlation function defined in this case?

$$\mathrm{corr}(\mathbf{X},\mathbf{Y}) \, \triangleq \, ?$$

-
Then the correlation is a matrix where the $(i,j)$th entry is the correlation between $X_i$ and $Y_j$. –  Stefan Hansen Mar 31 '13 at 8:40

## 1 Answer

You almost answered your own question. Just put vectors with $X$ and $Y$ and transpose one of them to get a matrix: a covariance matrix. So, $$\mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \,(\vec{\mathbf{X}}-E[\vec{\mathbf{X}}]).(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}])^{T}$$ is a matrix with entries: $\mathrm{cov}(\mathbf{X},\mathbf{Y})_{ij}=\langle(X_i-\mu_{X_i})(Y_j-\mu_{Y_j})\rangle$.

-
As far as I see, "correlation" and "covariance" are different things in single variable case. Are they the same things in multivariate case? Because, my question was about correlation, not covariance. –  hkBattousai Apr 1 '13 at 4:47
@hkBattousai the difference is "in the mean". If you substract the mean from the vector (or scalar, that doesn't matter) then you have covariance if you don't then correlation. It is just terminology. $\mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \,(\vec{\mathbf{X}}-E[\vec{\mathbf{X}}]).{(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}])‌​}^{T}$ and $\mathrm{cor}(\mathbf{X},\mathbf{Y}) \, \triangleq \,\vec{\mathbf{X}}.\vec{\mathbf{Y}}^{T}$ –  Caran-d'Ache Apr 1 '13 at 7:00
Isn't covariance defined as $\, \mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \, E\big[(\vec{\mathbf{X}}-E[\vec{\mathbf{X}}])(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}‌​])^{T}\big] \,$? You wrote $\, \mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \, (\vec{\mathbf{X}}-E[\vec{\mathbf{X}}])(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}])^{T} \,$ instead. Are you sure that your definition is correct? –  hkBattousai Apr 1 '13 at 11:23
Well, yes sure, expectation should be taken. My fault, I was inattentive and one can correct the comment only during the period of 5 minutes. :( –  Caran-d'Ache Apr 1 '13 at 11:45