Use of Regression to Calculate Sum of Squares

From ReliaWiki

Jump to: navigation, search


Index

Appendix B  
Use of Regression to Calculate Sum of Squares  

This appendix explains the reason behind the use of regression in DOE++ in all calculations related to the sum of squares. A number of textbooks present the method of direct summation to calculate the sum of squares. But this method is only applicable for balanced designs and may give incorrect results for unbalanced designs. For example, the sum of squares for factor A\,\! in a balanced factorial experiment with two factors, A\,\! and B\,\!, is given as follows:


\begin{align}
  & S{{S}_{A}}= & \underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,{{n}_{b}}n{{({{{\bar{y}}}_{i..}}-{{{\bar{y}}}_{...}})}^{2}} \\ 
 & = & \underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,\frac{y_{i..}^{2}}{{{n}_{b}}n}-\frac{y_{...}^{2}}{{{n}_{a}}{{n}_{b}}n}  
\end{align}\,\!


where {{n}_{a}}\,\! represents the levels of factor A\,\!, {{n}_{b}}\,\! represents the levels of factor B\,\!, and n\,\! represents the number of samples for each combination of A\,\! and B\,\!. The term {{\bar{y}}_{i..}}\,\! is the mean value for the i\,\!th level of factor A\,\!, {{y}_{i..}}\,\! is the sum of all observations at the i\,\!th level of factor A\,\! and {{y}_{...}}\,\! is the sum of all observations.

The analogous term to calculate S{{S}_{A}}\,\! in the case of an unbalanced design is given as:


S{{S}_{A}}=\underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,\frac{y_{i..}^{2}}{{{n}_{i.}}}-\frac{y_{...}^{2}}{{{n}_{..}}}\,\!


where {{n}_{i.}}\,\! is the number of observations at the i\,\!th level of factor A\,\! and {{n}_{..}}\,\! is the total number of observations. Similarly, to calculate the sum of squares for factor B\,\! and interaction AB\,\!, the formulas are given as:


\begin{align}
  & S{{S}_{B}}= & \underset{j=1}{\overset{{{n}_{b}}}{\mathop{\sum }}}\,\frac{y_{.j.}^{2}}{{{n}_{.j}}}-\frac{y_{...}^{2}}{{{n}_{..}}} \\ 
 & S{{S}_{AB}}= & \underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,\underset{j=1}{\overset{{{n}_{b}}}{\mathop{\sum }}}\,\frac{y_{ij.}^{2}}{{{n}_{ij}}}-\underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,\frac{y_{i..}^{2}}{{{n}_{i.}}}-\underset{j=1}{\overset{{{n}_{b}}}{\mathop{\sum }}}\,\frac{y_{.j.}^{2}}{{{n}_{.j}}}+\frac{y_{...}^{2}}{{{n}_{..}}}  
\end{align}\,\!


Applying these relations to the unbalanced data of the last table, the sum of squares for the interaction AB\,\! is:


\begin{align}
  & S{{S}_{AB}}= & \underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,\underset{j=1}{\overset{{{n}_{b}}}{\mathop{\sum }}}\,\frac{y_{ij.}^{2}}{{{n}_{ij}}}-\underset{i=1}{\overset{{{n}_{a}}}{\mathop{\sum }}}\,\frac{y_{i..}^{2}}{{{n}_{i.}}}-\underset{j=1}{\overset{{{n}_{b}}}{\mathop{\sum }}}\,\frac{y_{.j.}^{2}}{{{n}_{.j}}}+\frac{y_{...}^{2}}{{{n}_{..}}} \\ 
 & = & \left( {{6}^{2}}+{{4}^{2}}+\frac{{{(42+6)}^{2}}}{2}+{{12}^{2}} \right)-\left( \frac{{{10}^{2}}}{2}+\frac{{{60}^{2}}}{3} \right) \\ 
 &  & -\left( \frac{{{54}^{2}}}{3}+\frac{{{16}^{2}}}{2} \right)+\frac{{{70}^{2}}}{5} \\ 
 & = & -22  
\end{align}\,\!


which is obviously incorrect since the sum of squares cannot be negative. For a detailed discussion on this refer to Searle(1997, 1971).


Example of an unbalanced design.


The correct sum of squares can be calculated as shown next. The y\,\! and X\,\! matrices for the design of the last table can be written as:


y=\left[ \begin{matrix}
   6  \\
   4  \\
   6  \\
   12  \\
   42  \\
\end{matrix} \right]\text{   and   }X=\left[ \begin{matrix}
   1 & 1 & 1 & 1  \\
   1 & 1 & -1 & -1  \\
   1 & -1 & 1 & -1  \\
   1 & -1 & -1 & 1  \\
   1 & -1 & 1 & -1  \\
\end{matrix} \right]\,\!


Then the sum of squares for the interaction AB\,\! can be calculated as:


S{{S}_{AB}}={{y}^{\prime }}[H-(1/5)J]y-{{y}^{\prime }}[{{H}_{\tilde{\ }AB}}-(1/5)J]y\,\!


where H\,\! is the hat matrix and J\,\! is the matrix of ones. The matrix {{H}_{\tilde{\ }AB}}\,\! can be calculated using {{H}_{\tilde{\ }AB}}={{X}_{\tilde{\ }AB}}{{(X_{\tilde{\ }AB}^{\prime }{{X}_{\tilde{\ }AB}})}^{-1}}X_{\tilde{\ }AB}^{\prime }\,\! where {{X}_{\tilde{\ }AB}}\,\! is the design matrix, X\,\!, excluding the last column that represents the interaction effect AB\,\!. Thus, the sum of squares for the interaction AB\,\! is:


\begin{align}
  & S{{S}_{AB}}= & {{y}^{\prime }}[H-(1/5)J]y-{{y}^{\prime }}[{{H}_{\tilde{\ }AB}}-(1/5)J]y \\ 
 & = & 368-339.4286 \\ 
 & = & 28.5714  
\end{align}\,\!


This is the value that is calculated by DOE++ (see the first figure below, for the experiment design and the second figure below for the analysis).


Unbalanced experimental design for the data in the last table.


Analysis for the unbalanced data in the last table.
Personal tools
ReliaWiki.org
Create a book