How to Compute Vector Means
This lesson explains how to use matrix
methods to compute the
means of
vector
elements and the means of
matrix
columns.
Mean Scores: Vectors
In ordinary algebra, the mean of a set of observations is computed by adding
all of the observations and dividing by the number of observations.
x = Σx_{i} / n
where x is the mean of observations,
Σx_{i} is the sum of all observations, and
n is the number of observations.
In matrix algebra, the mean of a set of n scores can be computed
as follows:
x =
1'x
( 1'1 )^{1} =
1'x ( 1/n )
where
x is the mean of a set of n scores
1 is an n x 1 column
vector
of ones
x is an n x 1 column
vector
of scores: x_{1}, x_{2}, . . . ,
x_{n}
To show how this works, let's find the mean of elements of vector
x, where x' = [ 1 2 3 ].
x =

[ 1 1 1 ] 



( 

[ 1 1 1 ] 


)^{1} 
x = 6/3 = 2
Thus, the mean of the elements of x is 2.
Mean Scores: Matrices
You can think of an r x c
matrix
as a set of c
column vectors, each having r elements. Often, with matrices,
we want to compute mean
scores separately within columns, consistent with the
equation below.
X_{c} =
Σ X_{i}_{c} / r
where
X_{c}
is the mean of a set of r scores from column c
Σ X_{i}_{c}
is the sum of elements from column c
In matrix algebra, a vector of mean scores from each column of
matrix X can be computed as follows:
m' =
1'X
( 1'1 )^{1} =
1'X ( 1/r )
where
m' is a row vector of column means,
[ X_{1}
X_{2} ...
X_{c} ]
1 is an r x 1 column
vector
of ones
X is an r x c matrix of scores:
X_{1}_{1}, X_{1}_{2}, . . . ,
X_{r}_{c}
The problem below shows how everything works.
Test Your Understanding
Problem 1
Consider matrix X.
Using matrix methods, create a 1 x 3 vector m', such that
the elements of m' are the mean of column elements from
X. That is,
m' = [ X_{1}
X_{2}
X_{3} ]
where X_{i} is the mean of elements
from column i of matrix X.
Solution
To solve this problem, we use the following equation:
m' =
1'X
( 1'1 )^{1}. Each step
in the computation is shown below.
m' = 
1' 

X 

( 

1' 

1 
)^{1} 

m' =

[ 1 1 ] 



( 

[ 1 1 ] 


)^{1} 
Thus, vector m has the mean column scores from
matrix X. The mean score for column 1 is 6,
the mean score for column 2 is 3, and the mean score for column 3 is 2.5.