English

# How to Calculate Correlation Matrix from Covariance Matrix

## How to Calculate Correlation Matrix - Definition, Formula, Example

##### Definition:

Correlation matrix is a type of matrix, which provides the correlation between whole pairs of data sets in a matrix.

#### Formula:

##### 1) Sum of Squared Matrix
 1/ (n-1) SSxx SSxy SSxz SSyx SSyy SSyz SSzx SSzy SSzz
###### Where,

n = N x N Matrix Value SSxx = ∑(xi - x̄)2 SSxy = ∑(xi - x̄) X (yi - ȳ) |||ly, SSyz = ∑(yi - ȳ) X (zi - z̄)

##### 2) Correlation Matrix
 1 Pxy Pxz Pyx 1 Pyz Pzx Pzy 1
###### Where,

n = N x N Matrix Value Pxy = SSxy / √(SSxx X SSyy)

##### Example :

Find out the correlation matrix from the given 3 X 3 matrix?

##### Matrix,
 1 4 7 6 5 4 9 5 1
##### Given:

n = 3 x̄ = (1 + 4 + 7) / 3 = 4 ȳ = (6 + 5 + 4) / 3 = 5 z̄ = (9 + 5 + 1) / 3 = 5

##### Solution :
###### Step : 1

First, let us calculate the matrix value for Sum of Squared Matrix.

###### Sum of Squared Matrix
 = 1/ (n-1) SSxx SSxy SSxz SSyx SSyy SSyz SSzx SSzy SSzz
 = 1/ (3-1) (1-4)2 + (4-4)2 + (7-4)2 (1-4)x(6-5) + (4-4)x(5-5) + (7-4)x(4-5) (1-4)x(9-5) + (4-4)x(5-5) + (7-4)x(1-5) (6-5)x(1-4) + (5-5)x(4-4) + (4-5)x(7-4) (6-5)2 + (5-5)2 + (4-5)2 (6-5)x(9-5) + (5-5)x(5-5) + (4-5)x(1-5) (9-5)x(1-4) + (5-5)x(4-4) + (1-5)x(7-4) (9-5)x(6-5) + (5-5)x(5-5) + (1-5)x(4-5) (9-5)2 + (5-5)2 + (1-5)2
 = 1/2 9 + 0 + 9 -3 + 0 + -3 -12 + 0 + -12 -3 + 0 + -3 1 + 0 + 1 4 + 0 + 4 -12 + 0 + -12 4 + 0 + 4 16 + 0 + 16
 = 1/2 18 -6 -24 -6 2 8 -24 8 32
 = 9 -3 -12 -3 1 4 -12 4 16
###### Step : 2

Calculate the matrix value of Correlation Matrix.

 = 1 Pxy Pxz Pyx 1 Pyz Pzx Pzy 1
 = 1 -3 /√(9x1) -12 /√(9x16) -3 /√(1x9) 1 4 /√(1x16) -12 /√(16x9) 4 /√(16x1) 1
 = 1 -3/3 -12/12 -3/3 1 4/4 -12/12 4/4 1
 = 1 -1 -1 -1 1 1 -1 1 1