We have seen that Malinowski cares about “target testing”. That is, having reduced the dimension of his data, he goes looking for other vectors that lie in or near the “factor space”. Let me show you why. I ought to say that I really like what we do here.
This will be a long post, but I hope most of it is familiar; and much of it will be matrices being printed only for reference should you be following the actual computations.
Here’s the data for what he calls a hypothetical example, on p. 6, way before we can actually follow what he’s doing. We have a problem with notation, so I’m going to call the data matrix D instead of X.
Each row measures a response to a specific frequency of ultraviolet light; each column is a different substance.
get the SVD three ways
First I get the SVD, . (If I have the data, I’ll always get the SVD.)
For reference, in case you are working along with me, here is u:
What we really want to look at is w:
Assume that the 3 smallest singular values are noise, or negligible. There are two ways to do this. One is to leave the size of w unchanged, but zero out the three smallest singular values. Let me call this w0:
Using w0 we could compute a “reconstituted” data matrix .
We have not changed the data very much. The rounded differences between D and D1 are:
Note that D1 was computed using the same u and v as D. This is advantageous if we’re considering more than one possible w0, i.e. if it’s not obvious to us how many singular values to zero-out, so we consider more than one possibility.
OTOH, we could use the cut-down SVD: not only zero-out the last three singular values, but also cut w down to an invertible 2×2 matrix; call it w1.
Once we change the size of w, we need to cut down u and v to the appropriate sizes. They each need to keep only the first 2 columns of u and v respectively. As usual, I call them u1 and v1.
For reference, then, here’s u1:
then we could compute
and it is the same D1 we computed earlier using w0:
All those zeroes in w0 wipe out any effects of the additional columns of u and v; alternatively, the additional columns of v have eigenvalue 0.
So, we have three SVDs, one for the original data D and two for the “reconstituted data” D1.
get the product R C
We recall that Malinowski’s next step is to factor the reconstituted D1 as , naming the two pieces R and C: and .
The crucial fact is that R and C and D1 are of rank 2: our 5 substances are mixtures of two other substances (at least, only 2 that reacted over that range of frequencies).
He is saying that the responses of the 5 mixtures are linear combinations of the responses of the chemical components of the mixtures. But what might the chemical components be? More importantly, how can we figure out what they are?
That is what target testing does in this example: it identifies chemical components in the mixtures.
He has 3 test vectors, which are the responses of o-xylene, m-xylene, and p-xylene (at those ultraviolet frequencies).
As an aside, he recommends target testing of basis vectors and a vector of all 1s. I will omit these tests in this case. I did perform them, but the most significant result was: I have to say I prefer making inferences based on the new components of x rather than on the difference between x and . (See below.)
i want the hat matrix :
Now, here are the known responses of our 3 potential chemical components (o-, m-, and p-xylene).
BTW, if we had some data missing on the xylenes, we could have used his tricks discussed in “missing data”. We might not have to run more experiments on the xylenes in order to test them against our unknown mixtures, if we’re missing a couple of rows.
Target test them: for each , compute . (For subsequent computations, be aware that I rounded these answers.)
Look at the differences:
Let’s not get distracted by statistical tests or empirical measures: let’s take it as established that x1 and x3 are in the factor space, while x2 is not. Our 5 mixtures are composed of o-xylene and p-xylene. This is the cat’s meow.
BTW, here’s why I don’t compute t’s first, then the : I will need the t’s for x1 and x3, but not for x2. More importantly, if my collection of test vectors had been a few hundred chemical compounds rather than three, there would be few hundred t’s which I would never need to know or compute.
I want to look at this the other way. By computing the directly, we were comparing old components of x and . Let’s also look at the new components of the x’s (WRT the u basis). Going from old components to new, we apply the inverse transition matrix, which is the transpose because u is orthogonal:
We see that x1 and x3 have very nearly zero for all components after the first two. We attribute the discrepancies to experimental error (in either the components, or the mixtures, or both). For x2, its 2nd component is very small, while its 4th is not that small.
As I said, I am more comfortable assessing the fit of any test vector by finding its new components and seeing directly how far out of the factor space it lies. OTOH, if we know our average experimental errors, it’s the x and xhat we should be comparing; I blithely zeroed out the “small” singular values – but what if we have a trace amount of a third chemical? Ideally, “small” depends on knowing something about the experimental errors. If we have no such information, then I can justify my preference to look at new components.
Let’s make sure we understand the relationship between new components and old: what are the new components of the ? If you need to think about that, I should let you. Answer to follow, but not immediately.
Malinowski ended his presentation with the computation of the and the comparison of them to the x’s, concluding that the data represented 5 mixtures of 2 chemical components.
getting the t vectors
Now I’m going to diverge from Malinowski. He explicitly says that he wants to study a different product from the one I will construct, because, he says on p. 64, “In effect, the model would be forced to fit the data.” He does, however, need the pieces of this product.
Let me show you how exactly how the model “fits the data.”
The burning question in my mind is: now that we believe that we have 5 mixtures of o-xylene and p-xylene, what are the chemical compositions of the mixtures? Let me show it to you first.
I could get two t vectors, each would be of length 2, and I could form a 2×2 invertible matrix T whose columns were the t’s. Then I could write
But , the matrix whose columns are . Then we have
and it seems appropriate to denote by , so we can write
This is one of the things I love about Malinowski’s work: everything comes together right there. is not only a least-squares fit (and a set of least-squares fits), but the matrix T built from the t vectors provides the desired change-of-basis.
So, we need to get the t’s for x1 and x3. Ah, I have never shown you how to do this. There are two ways, and they look frighteningly similar and different. One is
and the other is
Yes, it makes no difference whether I use x or on the RHS.
There are any number of ways to see that. First, we can derive both equations. Second, roughly speaking, it’s because the hat matrix H is idempotent, so we have . Third, once we have both x and , running a regression with gets the same coefficients t as running a regression with x. We wouldn’t usually do that, of course, but if we did….
Here’s a derivation of the formula with :
where u1 is orthonormal and w1 is invertible. Pre-multiply by :
and then pre-multiply by :
Here’s a derivation of the formula with x:
The original definition of t was as the coefficients of a least squares fit:
but we worked all of that out once before. Here it is again:
So I define
Here are the two t’s:
I did also check the formula
because I rounded the earlier, so i didn’t now have accurate values to apply G to directly. I did, indeed, get the same answers.
the physical product Xhat Yhat
i want those two t vectors as columns of a matrix T:
I remind us that we have both
It is that last equation of which Malinowski says, “In effect, the model would be forced to fit the data.” I’m sure of one of his recommendations: replace by X itself, and compare the product
with the original data matrix D; i.e. study the differences
That uses the data D and the data X, and encapsulates our model in . For now, I return to the true decomposition
We set out to get the chemical compositions of the mixtures. I hope you realize that we are going to find compositions using the instead of the . Here’s where the least-squares interpretation comes in handy. The reconstituted mixtures (i.e. the columns of the matrix D1 of reconstituted data) are not exactly linear combinations of the x’s, but they are exactly linear combinations of the . We just need to find the coefficients for those linear combinations. If we view the two and as a (newer) basis, we just want the components of D1 wrt the newer basis.
But we already have the answers. (What? I’m not going to write an explicit transition matrix? No. Wonders never cease.)
We can interpret
as saying that the five columns of D1 are five linear combinations of the two columns of , and that the coefficients for the combinations are given by the five columns of . Let me round them:
That is, for example, the first column of D1 represents a .245 and .01 mixture of o-xylene and p-xylene:
Those are not actually compositions: they add up to .255 instead of 1. Maybe Yhat has to be interpreted as ratios: the first mixture is about 25:1, the second is 50:20, then 70:50, 40:76, 10:40.
Perhaps the sum .255 means that 74.5% of the first mixture is non-reactive? Unfortunately “compositions” 3 and 4 both sum to more than 1, so that interpretation doesn’t work. The responses of the mixtures are linear combinations of the responses of the components, but the coefficients are not exactly compositions. For reference, here are the rounded column sums of Yhat:
This was the most attractive part of what I found in Malinowski. We have seen a physical use for target testing, and the use of the t coefficients to express the mixture data in terms of other chemical component data.
From the SVD
and other data which gave us successful test vectors X, we have obtained a physically meaningful decomposition of the data,
isn’t literally compositions, but we infer that our 5 substances are mixtures of just two chemical compounds, and we can quantify the mixtures.
This seems fine to me. Malinowski said on p. 24: “… we try to model the data in a fundamental way, seeking a solution of the form …. [This equation] expresses the high point of [target factor analysis]. Solutions of this type are the crown jewels of factor analysis.”
Malinowski says we should look at two other things: in one case it’s pretty clear that he recommends studying the difference between the original data D and the product instead of the product . In the other case, I believe he has a typo on the page where he describes that. It’s important enough that I will include it in the next post, which I think will be the final one – a summary – about Malinowski.
Oh, I owe you an answer. What are the new components of the ? Well, the lie exactly in the 2D factor space, so only their first two components are nonzero. That’s why we care if the new components – after the first two – of the x vectors are small, i.e. close to the zero new components of the .
In case you want them:
(That only the first two new components of are nonzero tells us nothing about the new components of .)