Quiz: least-squares unmixing
Before this unit: Bleed-through and compensation (previous unit); Day 46: Colour.
See also: Day 3: Bit depth and noise; Day 16: Measurements.
Short questions to test your understanding. Try each on paper first, then open the answer. A pixel with N channel values is \mathbf y \approx M\mathbf a, with the K component spectra as the columns of M (N > K); least squares gives \hat{\mathbf a} = M^+\mathbf y, M^+ = (M^\top M)^{-1}M^\top.
Q1. Why can’t you simply invert M when there are 16 channels and 4 dyes?
What shape is M? How many equations per pixel?
M is 16 \times 4: not square, no inverse. Each pixel gives 16 equations for 4 unknowns; with noise they cannot all hold. Least squares takes the 4 abundances whose mixture is closest to the measured spectrum.
Q2. Geometrically, what is the least-squares fit M\hat{\mathbf a} of a pixel, and what is the residual?
Think of 3 channels and 2 dyes: the set of all mixtures is a plane.
The fit is the orthogonal projection of the pixel onto the column space of M (all mixtures of the spectra): the nearest explainable spectrum. The residual is the perpendicular part, \mathbf y - M\hat{\mathbf a}, orthogonal to every component spectrum.
Q3. Why is unmixing a 512 \times 512 image with 32 channels cheap, even though every pixel needs its own least-squares fit?
What does M^+ depend on?
M^+ depends only on the reference spectra, not on the pixel: compute it once (K \times 32), then every pixel’s abundances are one small matrix–vector product, \hat{\mathbf a} = M^+\mathbf y. The whole image is one matrix product M^+Y.
Q4. After unmixing, the residual map is at the noise level everywhere except in the cytoplasm, where it is clearly higher. What would you suspect, and how would you test it?
The residual is what no combination of your reference spectra can explain.
A component is missing from M, present in the cytoplasm only: typically autofluorescence (or an unexpected dye, or an offset). Look at the residual spectrum of those pixels, add a spectrum of that shape as an extra column (from an unstained control, for example) and check that the residual drops to the noise level.
Q5. Two dyes have nearly the same spectrum. Which is better determined: the sum of their abundances or the difference? Why?
What happens to the measured spectrum if you add a little of dye 1 and remove the same amount of dye 2?
The sum. Trading dye 1 for dye 2 hardly changes the measured spectrum, so the data cannot pin down the difference: noise moves it a lot. The total amount of light, and hence the sum, is well measured. In the math: M^\top M has a small eigenvalue with eigenvector \approx (1, -1).
Q6. A colleague says “with 32 channels instead of 8 we can separate any two dyes”. Is that right?
Do finer bins create new photons? Do they change the shapes?
No. Finer bins over the same range sample the shapes better and help a little (in the demo, noise × 5.7 → 4.7 for dyes 6 nm apart), but they add no photons, and two identical shapes stay inseparable however finely you sample them (\kappa = \infty). What helps more: dyes further apart, more photons.
Q7. In a photon-starved image, why give a channel with 4 expected counts more weight than one with 400?
For Poisson counts the variance equals the mean.
The channel with 400 counts has variance 400 (sd 20); the one with 4 counts has variance 4 (sd 2). In absolute terms the dim channel’s error is ten times smaller, so it deserves more weight: weighted least squares uses w_c = 1/\text{expected count}. (In relative terms the dim channel is noisier: 50 % against 5 %.)
Q8. (math) Show that P = M(M^\top M)^{-1}M^\top satisfies P^2 = P. What does that mean for a pixel that is already a perfect mixture?
Multiply out; the middle M^\top M cancels one inverse.
P^2 = M(M^\top M)^{-1}(M^\top M)(M^\top M)^{-1}M^\top = M(M^\top M)^{-1}M^\top = P. Projecting twice changes nothing: a pixel that already lies in the column space, \mathbf y = M\mathbf a, has P\mathbf y = \mathbf y, its abundances are recovered exactly and its residual is zero.