Canonical discriminant directions (source code)

= Canonical discriminant directions
{title2=$Ba=\lambda Wa$}

For positive-definite within-group scatter $W$ and between-group scatter $B$, directions maximizing $a^TBa/(a^TWa)$ solve the displayed <generalized eigenvalue problem>. Put $u=W^{1/2}a$; the quotient becomes the <Rayleigh quotient> of $W^{-1/2}BW^{-1/2}$. Its ordered orthonormal <eigenvectors> give directions orthogonal in the $W$ inner product. There are at most $g-1$ nonzero directions, where $g$ is the number of groups. These directions summarize separation for <linear discriminant analysis>.