This lesson explains how to use matrix
methods to transform raw scores to deviation scores.
We show the transformation to deviation scores for
vectors and for
matrices.
Deviation Scores: Vectors
A deviation score is the difference between a raw score
and the mean.
d_{i} = x_{i}  x
where
d_{i} is the deviation score for the ith observation in
a set of observations
x_{i} is the raw score for the ith observation in
a set of observations x is the mean of all the observations in
a set of observations
Often, it is easier to work with deviation scores than with raw scores.
Use the following formula to transform a
vector of
n raw scores into a vector of n deviation scores.
d =
x 
1'x1
( 1'1 )^{1} =
x 
1'x1
( 1/n )
where
1 is an n x 1 column
vector
of ones d is an n x 1 column vector
of deviation scores: d_{1}, d_{2}, . . . ,
d_{n} x is an n x 1 column vector
of raw scores: x_{1}, x_{2}, . . . ,
x_{n}
To show how this works, let's transform the raw scores in vector
x to deviation scores in vector d.
For this example, let x' = [ 1 2 3 ].
d =
x

1'
x
1
(
1'
1
)^{1}
d =
1
2
3

[ 1 1 1 ]
1
2
3
1
1
1
(
[ 1 1 1 ]
1
1
1
)^{1}
d =
1
2
3

2
2
2
=
1
0
1
Note that the mean deviation score is zero.
Deviation Scores: Matrices
Let X
be an r x cmatrix
holding raw scores; and let
x be the corresponding r x c matrix
holding deviation scores.
When transforming raw scores from X into deviation
scores for x, we often want to compute deviation
scores separately within columns, consistent with the
equation below.
x_{r}_{c} =
X_{r}_{c}  X_{c}
where
x_{r}_{c} is the deviation score from row r
and column c of matrix x X_{r}_{c} is the raw score from row r
and column c of matrix X X_{c}
is the mean score, based on all r scores from
column c of matrix X
To transform the raw scores from matrix X into
deviation scores for matrix x, we use this matrix equation.
x = X 
11'X
( 1'1 )^{1} =
X 
11'X
( 1 / r )
where
1 is an r x 1 column
vector
of ones x is an r x c matrix
of deviation scores: x_{1}_{1},
x_{1}_{2}, . . . ,
x_{r}_{c} X is an r x c matrix
of raw scores: X_{1}_{1},
X_{1}_{2}, . . . ,
X_{r}_{c}
Note: Deviation score matrices are often denoted by a lowercase, boldface
letter, such as x. This can cause confusion, since
vectors are also denoted by lowercase, boldface letters; but usually the
meaning is clear from the context.
Test Your Understanding
Problem 1
Consider matrix X.
X =
3
5
1
9
1
4
Using matrix methods, create a 2 x 3 vector D, such that
the elements of D are deviation scores based on elements from
X. That is,
D =
3  X_{1}
5  X_{2}
1  X_{3}
9  X_{1}
1  X_{2}
4  X_{3}
where X_{c} is the mean of elements
from column c of matrix X.
Solution
To solve this problem, we use the following equation:
D = X 
11'X
( 1 / r ).
Each step in the computation is shown below.
D =
X

1
1'
X
( 1/r )
D =
3
5
1
9
1
4

1
1
[ 1 1 ]
3
5
1
9
1
4
( 1/r )
D =
3
5
1
9
1
4

1
1
1
1
3
5
1
9
1
4
( 1/2 )
D =
3
5
1
9
1
4

12
6
5
12
6
5
( 1/2 )
D =
3
5
1
9
1
4

6
3
2.5
6
3
2.5
D =
3
2
1.5
3
2
1.5
Thus, matrix D has the deviation scores, based on raw scores from
matrix X. Note that the mean and sum of each column in matrix
D is zero.