Worksheet - Variance-Covariance Matrix and Correlation Matrix using Matrix Algebra

Section 1

Raw data (i.e., Raw score matrix) and calculate mean vectors and standard deviations

Variable

Individuals

Σ

Mean

σ2
σ
x1_raw

1

2

1

5

4

13

2.6

3.3
1.8166
x2_raw

2

3

2

4

4

15

3.0

   
x3_raw

3

4

3

5

4

19

3.8

   

Obtain a listing of deviations from the mean vector (i.e., deviation matrix)

Var

Individuals

Deviations from Variable Means

x1
-1.6




x2





x3





Matrix multiplication - this procedure calculates the crossproduct of the original matrix of differences (A) with a transposed copy (A') of itself (i.e., one in which rows and columns have been inverted). This results in a new matrix with dimensions of 3 (i.e., rows of A) x 3 (i.e., (columns of A')

-1.6

-0.6

-1.6

2.4

1.4

-1

0

-1

1

1

-0.8

0.2

-0.8

1.2

0.2

*
-1.6 -1 -0.8
-0.6 0 0.2
-1.6 -1 -0.8
2.4 1 1.2
1.4 1 0.2
=

Σ (-1.62 + -.62 + -1.62 + 2.42 + 1.42)




Σ (-12 + 02 + -12 + 12 + 12)




Σ (-.82 + .22 + -.82 + 1.22 + .22)

Arrange values into Deviation SSCP (Sums of Squares and Cross Products) matrix and compare with the values obtained in the correlation worksheet. This procedure calculates the sums of squares along the diagonal and the sums of Cross product in the lower triangle off the diagonal. All products are calculated as length vector 1 * length of vector 2 * sine of angle between vector 1 and 2. As the different variables are orthogonal to each other (i.e., the angle between them is 90o), the angle term of the product formula therefore is always 1 (i.e., sine(90o) = 1) and can thus be dropped from these calculations. Note there are three different, mathematically equivalent techniques to calculate the deviation SSCP. The symbol X in all tables below refers to the differences from the mean and not the raw variable measures.

Symbols

Example Numbers

Σ X12


13.2



Σ X1X2
Σ X22




Σ X1X3
Σ X2X3
Σ X32



Variance-Covariance Matrix. This procedure calculates the variance (i.e., MS) for each variable along the diagonal and the covariances the lower triangle off the diagonal. Recall that variance estimates refer to a sum of squares divided by its degrees of freedom

Symbols

Example Numbers

σ21=Σ(X12)/(N-1)


3.3



Σ(X1X2)/(N-1)
σ22=Σ(X22)/(N-1)




Σ(X1X3)/(N-1)
Σ(X2X3)/(N-1)
σ23=Σ(X32)/(N-1)



Correlation Matrix. i.e., Standardized variance/covariance matrix - Divide each entry by two standard deviations (σ), one for each relevant row and column.

Symbols

Example Numbers


x1
x2
x3
x1
x2
x3
x1
r11 = Σ(X12)/((N-1)σ1σ1)


1



x2
r12 = Σ(X1X2)/((N-1)σ1σ2)
r22 = Σ(X22)/((N-1)σ2σ2)




x3
r13 = Σ(X1X3)/((N-1)σ1σ3)
r23 = Σ(X2X3)/((N-1)σ2σ3)
r33 = Σ(X32)/((N-1)σ3σ3)



Matrix of Coefficients of Determination (r2) - Note: Do not use in Correlation analysis as it assumes a level of causality of the independent over the dependent variable. Square each entry from above.

Symbols

Example Numbers

 
x1
x2
x3
x1
x2
x3
x1
r211 = (Σ(X12)/((N-1)σ1σ1))2    

1


x2
r212 = (Σ(X1X2)/((N-1)σ1σ2))2 r222 = (Σ(X22)/((N-1)σ2σ2))2      
x3
r213 = (Σ(X1X3)/((N-1)σ1σ3))2 r223 = (Σ(X2X3)/((N-1)σ2σ3))2 r233 = (Σ(X32)/((N-1)σ3σ3))2      

If you have difficulties in performing these steps, review some of the basic concepts in matrix algebra.

Section 2

Rerun all calculations from above with data converted to standard normal deviates (i.e., standardized score matrix) where you subtract the variable's mean from each value and divide it by the variable's standard deviation.

Variable

Individuals

Σ
σ2
σ
x1_stand

-0.8808

 

 

 

 



 

x2_stand

 

 

 

 

 



 

x3_stand

 

 

 

 

 



 

- continue with calculations from section 1.


last modified: 2/10/14