| 1 | <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 | <title>SSCP: To CCA...</title> |
| 3 | <style> |
| 4 | td { padding-left: 5pt; padding-right: 5pt; } |
| 5 | th { padding-left: 5pt; padding-right: 5pt; } |
| 6 | code { white-space: pre-wrap; } |
| 7 | dd { white-space: pre-wrap; } |
| 8 | </style> |
| 9 | </head><body bgcolor="#FFFFFF"> |
| 10 | |
| 11 | <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b> |
| 12 | SSCP: To CCA... |
| 13 | </b></font></table></table> |
| 14 | <p>A command that creates a <a href="CCA.html">canonical correlation</a> object from the selected <a href="SSCP.html">SSCP</a> object.</p> |
| 15 | <h2>Setting</h2> |
| 16 | <dl> |
| 17 | <dt><b>Dimension of dependent variate (ny)</b> |
| 18 | <dd>defines a partition of the square <i>n</i> x <i>n</i> SSCP matrix S into the parts S<sub>yy</sub> of dimension <i>ny</i> x <i>ny</i>, S<sub>xx</sub> of dimension <i>nx</i> x <i>nx</i>, and the parts S<sub>xy</sub> and S<sub>yx</sub> of dimensions <i>nx</i> x <i>ny</i> and <i>ny</i> x <i>nx</i>, respectively.</dd> |
| 19 | </dl> |
| 20 | <h2>Algorithm</h2> |
| 21 | <p>The partition for the square SSCP-matrix is as follows:</p> |
| 22 | <p align=middle><img height=200 width=200 src=SSCP__To_CCA____1.png></p><p>The canonical correlation equations we have to solve are:</p> |
| 23 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle>(1) (<b>S</b><sub><i>yx</i></sub> <b>S</b><sub><i>xx</i></sub><sup>-1</sup> <b>S</b><sub><i>yx</i></sub>′ -λ <b>S</b><sub><i>yy</i></sub>)<b>y</b> = <b>0</b></table> |
| 24 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle>(2) (<b>S</b><sub><i>yx</i></sub>′ <b>S</b><sub><i>yy</i></sub><sup>-1</sup> <b>S</b><sub><i>yx</i></sub> -λ <b>S</b><sub><i>xx</i></sub>)<b>x</b> = <b>0</b></table> |
| 25 | <p>where <b>S</b><sub><i>yy</i></sub> [<i>ny</i> × <i>ny</i>] and <b>S</b><sub><i>xx</i></sub> [<i>nx</i> × <i>nx</i>] are symmetric, positive definite matrices belonging to the dependent and the independent variables, respectively. </p> |
| 26 | <p>These two equations are not independent and we will show that both equations have the same eigenvalues and that the eigenvectors <b>x</b> for equation (2) can be obtained from the eigenvectors <b>y</b> of equation (1).</p> |
| 27 | <p>We can solve equation (1) in several ways, however, the numerically stablest algorithm is probably by performing first a Cholesky decomposition of <b>S</b><sub>xx</sub> and <b>S</b><sub>yy</sub>, followed by a <a href="generalized_singular_value_decomposition.html">generalized singular value decomposition</a>. The algorithm goes as follows:</p> |
| 28 | <p>The Cholesky decompositions ("square roots") of <b>S</b><sub>yy</sub> and <b>S</b><sub>xx</sub> are:</p> |
| 29 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><b>S</b><sub>yy</sub> = <b>U</b>′ <b>U</b> and <b>S</b><sub>xx</sub> = <b>H</b>′ <b>H</b>,</table> |
| 30 | <p>where <b>U</b> and H are upper triangular matrices. From these decompositions, the inverse for <b>S</b><sub>xx</sub><sup>-1</sup> is easily computed. Let <b>K</b> be the inverse of <b>H</b>, then we can write: </p> |
| 31 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><b>S</b><sub>xx</sub><sup>-1</sup> = <b>K</b> <b>K</b>′.</table> |
| 32 | <p>We next substitute in equation (1) and rewrite as:</p> |
| 33 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle>((<b>K</b>′<b>S</b><sub>yx</sub>′)′ (<b>K</b>′<b>S</b><sub>yx</sub>′) - λ <b>U</b>′ <b>U</b>)<b>x</b> = 0</table> |
| 34 | <p>This equation can be solved for eigenvalues and eigenvectors by the generalized singular value decomposition because it is of the form <b>A</b>′<b>A</b> -λ <b>B</b>′<b>B</b>.</p> |
| 35 | <p>Now, given the solution for equation (1) we can find the solution for equation (2) by first multiplying (1) from the left with <b>S</b><sub>yx</sub>′<b>S</b><sub>yy</sub><sup>-1</sup>, resulting in:</p> |
| 36 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle>(<b>S</b><sub>yx</sub>′<b>S</b><sub>yy</sub><sup>-1</sup><b>S</b><sub>yx</sub><b>S</b><sub>xx</sub><sup>-1</sup><b>S</b><sub>yx</sub>′ -λ <b>S</b><sub>yx</sub>′) <b>y</b> = 0</table> |
| 37 | <p>Now we split of the term <b>S</b><sub>xx</sub><sup>-1</sup><b>S</b><sub>yx</sub>′ and obtain:</p> |
| 38 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle>(<b>S</b><sub>yx</sub>′<b>S</b><sub>yy</sub><sup>-1</sup><b>S</b><sub>yx</sub> - λ <b>S</b><sub>xx</sub>) <b>S</b><sub>xx</sub><sup>-1</sup><b>S</b><sub>yx</sub>′ <b>y</b> = 0</table> |
| 39 | <p>This equation is like equation (2) and it has therefore the same eigenvalues and eigenvectors. (We also proved this fact in the algorithmic section of <a href="TableOfReal__To_CCA___.html">TableOfReal: To CCA...</a>.)</p> |
| 40 | <p>The eigenvectors <b>x</b> is now</p> |
| 41 | <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><b>x</b> = <b>S</b><sub>xx</sub><sup>-1</sup><b>S</b><sub>yx</sub>′ <b>y</b>.</table> |
| 42 | <hr> |
| 43 | <address> |
| 44 | <p>© djmw 20031103</p> |
| 45 | </address> |
| 46 | </body> |
| 47 | </html> |