edited 17 Oct 2008 to round-off the first two columns of 5 u.
This is the 3rd post about the Bartholomew et al. book.
It would be convenient if Bartholomew’s model were one we had seen before.
We got their scores and loadings just by following their instructions. Although they didn’t use matrix notation, their equations amounted to
loadings = the -weighted eigenvector matrix,
“component score coefficients” = reciprocal basis vectors,
scores = X cs.
where V is an orthogonal eigenvector matrix of the correlation matrix, is the diagonal matrix of (nonzero) , X is the standardized data.
Let’s recall Harman’s model. He had
where Z was the transpose of the standardized data X:
and A is the ]-weighted eigenvector matrix, so we have
Transposing, we get
There are two crucial facts:
- Harman has factored the data matrix X as scores times loadings.
- The right factor is not orthogonal: A^T rather than V^T.
Terminology: Harman says the elements of F are the factor values, and the “coefficients of the factors” are loadings. I take it, therefore, that A is the loadings.
So can we compute F or F^T? In this case, yes: all the eigenvalues are nonzero, so A is invertible, and then
So let’s compute F^T. (You may have recognized . It is in fact the reciprocal basis to A, and that equation says that F^T is found by projecting the data onto the reciprocal basis. That’s exactly what Bartholomew had us do, without telling us that we were computing along the way.)
Before we do that, I want to be very careful about the signs of columns. In the previous post, for example, the A matrix which I computed differed from the A matrix which Bartholomew et al. computed. We know that’s ok, because eigenvectors of length 1 can be multiplied by -1 and still be eigenvectors of length 1. But I was not consistent about how I changed signs to confirm that our graphs matched: in fact while I had a different A matrix from them, I defined my “component score coefficients” to match theirs. That was not consistent.)
But now, if I want to check my computations by multiplying the scores times the loadings, I need a consistent set of signs for the columns.
Rewriting Bartholomew’s scores
My personal preference for achieving that is to start with the orthogonal v matrix from the SVD (singular value decomposition) and construct A from it. You’ll see why, below.
What follows seems to be my adopted recipe for doing PCA / FA, although it’s cluttered here by comparisons to Bartholomew’s calculations. You’ll see it again.
First, decide what “the data” is to be: raw, centered, standardized, etc. We know that Bartholomew used standardized data, so let X be the standardized data, and let
be its SVD.
I remind us that the dimensions are
X: 26 x 9
u: 26 x 26
w: 26 x 9
v: 9 x 9
That is, u and v are square (as they must be: they are orthogonal); and w is the same shape as the data X.
Right now, I wish to use Harman’s & Bartholomew’s model, i.e. the correlation matrix. Rather than do algebra in my head, I’m going to compute the correlation matrix of X… get just its eigenvalues …
That’s all I want the correlation matrix for: its eigenvalues. Instead of its eigenvector matrix V, with whatever signs Mathematica® returns, I use the v matrix from the SVD.
Then create a diagonal matrix whose entries are the square roots of those eigenvalues; that is, the diagonal entries are
Let me remind us that w0, the cut-down w, is the same shape as . That is, let w0 be the square 9×9 submatrix of w:
I promised in the previous post that there would be one caveat, and here it is: w0 is proportional to , but not equal to it.
The proportionality constant is ; in this case, 5 because we have 26 observations. We have
It’s that proportionality that I know I will mess up unless I explicitly start with the eigenvalues of the correlation matrix.
then the -weighted matrix A is
and its first 2 columns, rounded off, are…
Those are loadings. They happen to match Bartholomew’s choice of signs.
The “component score coefficients” are computed as -weighted matrix v… that inverse square root tells me, and you, I hope, that the “component score coefficients” are the reciprocal basis to A.
The first two columns of the “component score coefficients” are…
They, too, match Bartholomew et al., as we would expect, since the first two columns of A matched. (I have labeled those “cs” but they are only the first two columns of the cs matrix, which is 9×9. I will consistently abuse that notation, because I’m going to be displaying matrices which are equal but computed differently. I really am displaying the results of computations, not just copying the thing that I’m supposed to get.)
The scores are computed by projecting the data onto the “component score coefficients”. That told me that Bartholomew’s scores were the new components of the data wrt the A basis. Here they are, as Bartholomew would compute them:
I need to plot these, to confirm that they are the same as Bartholomew’s.
We have reproduced the calculations in the previous post, but whereas I was changing signs all over the place in the previous post – in order to match their pictures – this time I know that I have a consistent set of signs for whatever calculations I choose to do.
Computing F transpose instead
Now I’m ready to get . Let’s compute and look at its first two columns: they should be the “component score coefficients”.
They are. Recall the “component score coefficients”, as computed according to Bartholomew:
Then F^T is the projection of X onto the reciprocal basis, and must agree with the scores as we already computed them:
Yes, the same.
Let’s check things. We can compute AF, compare it with Z = X^T. They should be equal…. I get differences of about 10^–15 or less.
Bartholomew’s “component score coefficients” are the columns of the reciprocal basis , and his scores are the matrix. Bartholomew et al. have factored the data matrix the same way Harman did. (Good. it’s nice that they agree with a classic text.)
There is another way
But there is another approach to all this. After all, we know how to factor a data matrix. In fact, I started this process by factoring it!
There’s just that one little caveat: the singular values w are not quite the square roots of the eigenvalues – because there’s a pesky factor of .
To be quite explicit, suppose we do an SVD of the standardized data X:
Now, compute the correlation matrix c..
but the eigendecomposition gave us
and we may choose, as I did, to set V = v. (That’s pretty major: we are requiring that u and V have consistent signs.) Then we see that
Hence (if we cut down w to w0 so that it is square)
(as we confirmed earlier.)
Now go back and rewrite the SVD (cutting down u to u0 that it is conformable, i.e. the right size) :
Now recognize (since ) and we have
For A invertible, we may then infer that
in this case, with N = 26, we have .
In other words, the scores are 5 u0.
(I have to tell you that I found that his scores were 5 u0 before I understood why. I was a little annoyed that they were so much simpler than projections onto a reciprocal basis.)
So let’s compute 5 u, and take its first two columns. (In fact, we could compute the full matrix 5u rather than 5 u0; I would never take more than 9 columns of it, because that’s all the columns I have of data X, and the scores are the new components of the data.)
Here are the first two columns of 5 u:
edit 17 oct 2008: while it isn’t essential, it would help if i rounded those off, and showed F^T:
Those are, indeed, first two columns of the scores, and the first two columns of F^T.
It’s the computation of 5u that requires the signs of A to be consistent with the signs of u. That’s why I will use v from the SVD instead of V from the eigendecomposition of a correlation or covariance matrix, even though I will calculate their eigenvalues. (If, and it’s a big if, I choose to use the correlation or covariance matrices at all.)
I want to confirm the factoring of the data, that the product of the scores and the loadings is the standardized data. Let’s compute (5 u0) A^T. For this I need the cut-down u. Since A is 9×9, u0 must have 9 columns.
So I compute it. the difference between the product and the data, , is the zero matrix (to within 10^-15 on each entry).
Let me emphasize that the showed up because we used instead of w. If we’d never seen the eigenvalues of the correlation matrix, computing scores would have been simpler, because we’d have used w instead of the square roots .
But, of course, the scores and loadings would have been different: we would have gotten a different matrix A. Instead of
we would have had
Anyway, we know 3 equivalent ways to compute the scores for Harman’s or Bartholomew’s model:
- project onto the reciprocal basis: either as or as .
- compute .
Ah, they’re not quite equivalent: what we just worked is a case where A was invertible.
What if A is not invertible? Equivalently, what if there’s a zero eigenvalue?
That is a very real possibility, even for real data: if the rows sum to exactly 1, then, as we saw, both the correlation matrix and the covariance matrix have a zero eigenvalue.
In such a case, is probably the way to go, although we can make the other computations work. Let’s look at such a case next time..