<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FAQ/matalg</title><revhistory><revision><revnumber>13</revnumber><date>2013-03-08 10:17:15</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>12</revnumber><date>2010-03-10 16:44:10</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>11</revnumber><date>2010-03-10 16:41:06</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>10</revnumber><date>2010-03-10 16:39:31</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>9</revnumber><date>2010-03-10 16:38:02</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>8</revnumber><date>2010-03-10 16:37:35</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>7</revnumber><date>2010-03-10 15:36:20</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>6</revnumber><date>2010-03-10 15:19:17</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>5</revnumber><date>2010-03-10 14:55:07</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>4</revnumber><date>2010-03-10 12:37:15</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>3</revnumber><date>2010-03-10 12:36:43</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>2</revnumber><date>2010-03-10 12:35:55</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>1</revnumber><date>2010-03-10 12:35:00</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><section><title>Matrix algebra derivation of Sums of Squares</title><informaltable><tgroup cols="3"><colspec colname="col_0" colwidth="17*"/><colspec colname="col_1" colwidth="38*"/><colspec colname="col_2" colwidth="45*"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"/><entry align="center" colsep="1" nameend="col_2" namest="col_1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>$$Z^{T}$$ = </para></entry><entry colsep="1" rowsep="1"><para> 1,...,1</para></entry><entry colsep="1" rowsep="1"><para> $$z_text{1}, … ,z_text{N}$$</para></entry></row></tbody></tgroup></informaltable><informaltable><tgroup cols="3"><colspec colname="col_0" colwidth="17*"/><colspec colname="col_1" colwidth="38*"/><colspec colname="col_2" colwidth="45*"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>$$Z^{T}Z =$$ </para></entry><entry colsep="1" rowsep="1"><para> N</para></entry><entry colsep="1" rowsep="1"><para> $$\sum_text{i}z_text{i}$$ </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"><para> $$\sum_text{i}z_text{i}$$ </para></entry><entry colsep="1" rowsep="1"><para> $$\sum_text{i}z_text{i}^text{2}$$ </para></entry></row></tbody></tgroup></informaltable><informaltable><tgroup cols="3"><colspec colname="col_0" colwidth="17*"/><colspec colname="col_1" colwidth="38*"/><colspec colname="col_2" colwidth="45*"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>$$(Z<superscript>{T}Z)</superscript>{-1} =$$ </para></entry><entry colsep="1" rowsep="1"><para> $$\frac{\sum_{i}z_{i}<superscript>{2}}{N\sum_text{i}z_{i}</superscript>{2}} $$</para></entry><entry colsep="1" rowsep="1"><para> 0 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"><para> 0 </para></entry><entry colsep="1" rowsep="1"><para> $$\frac{N}{N\sum_text{i}z_{i}^{2}}$$ </para></entry></row></tbody></tgroup></informaltable><para>which may be more simply as expressed as </para><informaltable><tgroup cols="3"><colspec colname="col_0" colwidth="17*"/><colspec colname="col_1" colwidth="38*"/><colspec colname="col_2" colwidth="45*"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>$$(Z<superscript>{T}Z)</superscript>{-1} =$$ </para></entry><entry colsep="1" rowsep="1"><para> $$\frac{1}{N} $$</para></entry><entry colsep="1" rowsep="1"><para> 0 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"><para> 0 </para></entry><entry colsep="1" rowsep="1"><para> $$\frac{1}{\sum_text{i}z_{i}^{2}}$$ </para></entry></row></tbody></tgroup></informaltable><informaltable><tgroup cols="3"><colspec colname="col_0" colwidth="17*"/><colspec colname="col_1" colwidth="38*"/><colspec colname="col_2" colwidth="45*"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>$$Z^{T}Y =$$ </para></entry><entry colsep="1" rowsep="1"><para> $$\sum_text{i} y_text{i}$$ </para></entry><entry colsep="1" rowsep="1"><para> $$\sum_text{i}z_text{i}y_text{i}$$ </para></entry></row></tbody></tgroup></informaltable><para>Then the regression terms are obtained using the least squares estimate B = $$(Z<superscript>text{T}Z)</superscript>text{-1}Z^text{T}Y$$. Two terms are required: in the regression of the standardised covariate on the difference in a pair of response level means we require the regression estimate of the intercept (W1) and the covariate (W1 x covariate). </para><para>For the intercept using the above B = average difference between levels of W1, call this $$\bar{y}$$ </para><para>For the W1 x covariate interaction B = $$\frac{\sum_text{i}z_text{i}y_text{i}}{\sum_text{i}z_{i}^{2}}$$ </para><para>Taking SS explained by the regression equal to B $$Z<superscript>text{T}Z$$ B (see e.g., Rao, Toutenburg, Shalabh and Heumann(2007)) and using the appropriate Bs above and the diagonal entries in $$Z\text</superscript>{T}Z$$ this gives W1 SS of $$\bar{y}\mbox{ x }\bar{y}$$ N and $$(\frac{\sum_text{i}z_text{i}y_text{i}}{\sum_text{i}z_{i}<superscript>{2}})</superscript>text{2}$$ x $$\sum_text{i}z_text{i}<superscript>text{2}$$ = $$\frac{(\sum_text{i}z_text{i}y_text{i})</superscript>text{2}}{\sum_text{i}z_{i}^{2}}$$ for the W1 x covariate SS. </para><para><emphasis role="underline">Reference</emphasis> </para><para>Rao CR, Toutenberg H, Shalabh, and Heumann C (2007). Linear models and generalizations: least squares and alternatives. Third Edition. Springer-Verlag:Berlin. </para></section></article>