\documentclass{seminar}
\usepackage{times,mathptm}
%\usepackage[dvips]{pstcol}
\usepackage{graphics}
\usepackage{epsfig}
\usepackage{color}
\usepackage{graphicx}
\usepackage{amsmath,bbm,amssymb}

\addtolength{\slidewidth}{2cm} \addtolength{\slideheight}{2cm}

% Makes the slides come out right side up
\special{! TeXDict begin /landplus90{true}store end }

\slideframe{none}

\definecolor{Blue}{rgb}{0.,0.,1.}
\definecolor{Red}{rgb}{1.,0.,0.}
\definecolor{Green}{rgb}{0.,1.,0.}

\def\~{{\tt\char'176}}

%\pagestyle{empty}

\usepackage{graphicx}

\renewcommand{\baselinestretch}{1.48}

\begin{document}

\newcommand{\heading}[1]{%
  \begin{center}
    \Large\bf
    \textcolor{Blue}{#1}
  \end{center}
  \vspace{1ex minus 1ex}}

\newcommand{\bc}{\begin{center}}
\newcommand{\ec}{\end{center}}
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\newcommand{\bs}{\begin{slide}}
\newcommand{\es}{\end{slide}}

%---------------------------------------------------------------------
% 1 -----------------------------------------------------------------

\bs
  \heading{Unit 2: Experiments with a Single Factor: \\One-Way ANOVA}

\bc Sources : Sections 2.1 to 2.3, 2.5, 2.6. \ec

\vspace{.1 in}

\bi
 \item One-way layout with fixed effects (Section 2.1).
 \item Multiple comparisons (Section 2.2).
 \item Quantitative factors and orthogonal polynomials (Section 2.3).
 \item Residual analysis (Section 2.6).
 \item One-way layout with random effects (Section 2.5).
\ei
 \es

%---------------------------------------------------------------------
% 2 -------------------------------------------------------------------
\bs
  \heading{One-way layout and ANOVA: An Example}
%\vspace{.2 in}

Reflectance data in pulp experiment: each of four operators made
five pulp sheets; reflectance was read for each sheet using a
brightness tester.

{\bf Randomization :} assignment of 20 containers of pulp to
operators and order of reading.
\begin{table}%[htbp]
\caption{Reflectance Data, Pulp Experiment}
\begin{center}
\begin{tabular}{|rrrr|} \hline
\multicolumn{4}{|c|}{Operator} \\[-6pt]
\multicolumn{1}{|c}{A}  & \multicolumn{1}{c}{B}  &
\multicolumn{1}{c}{C}  & \multicolumn{1}{c|}{D}  \\ \hline
59.8&59.8&60.7&61.0\\[-6pt]
60.0&60.2&60.7&60.8\\[-6pt]
60.8&60.4&60.5&60.6\\[-6pt]
60.8&59.9&60.9&60.5\\[-6pt]
59.8&60.0&60.3&60.5\\ \hline
\end{tabular}
\end{center}
\end{table}

{\bf Objective :} determine if there are differences among
operators in making sheets and reading brightness.

\es

%---------------------------------------------------------------------
% 3 -------------------------------------------------------------------
\bs

\heading{Model and ANOVA}

\noindent {\bf Model : }
%\begin{eqnarray*}
$y_{ij}= \eta + \tau_i + \epsilon_{ij}, i=1, \ldots, k; j=1,
\ldots, n_i,$ \\
%\end{eqnarray*}
 where $y_{ij} =$ $j$th observation with treatment $i$,\\
 $\tau_i =$  $i$th treatment effect,\\
 $\epsilon_{ij} = $ error, independent $N(0,\sigma^2)$.

\noindent {\bf Model fit: }
\begin{eqnarray*}
 y_{ij} &=&  \hat{\eta} + \hat{\tau_i} + r_{ij} \\
        &=& \bar{y}_{\cdot \cdot} + ( \bar{y}_{i \cdot} - \bar{y}_{\cdot
             \cdot}) +( y_{ij} - \bar{y}_{i \cdot}) ,
\end{eqnarray*}
where  `` . '' means average over the particular subscript.

\noindent {\bf  ANOVA Decomposition : } $$\sum_{i=1}^{k}
\sum_{j=1}^{n_i} {(y_{ij} - \bar{y}_{\cdot \cdot})}^2 =
\sum_{i=1}^{k} n_i {( \bar{y}_{i \cdot} - \bar{y}_{\cdot
\cdot})}^2 +\sum_{i=1}^{k} \sum_{j=1}^{n_i} {( y_{ij} - \bar{y}_{i
\cdot})}^2.$$

\es

%---------------------------------------------------------------------
% 4-------------------------------------------------------------------
\bs \heading{F-Test} \bc {ANOVA Table} \ec

\begin{table}[htbp]
$ $\\
\large\small \centering
\begin{tabular} {|llll|}
\hline \multicolumn{1}{|c}{} & \multicolumn{1}{c}{Degrees of} &
\multicolumn{1}{c}{Sum of} &
\multicolumn{1}{c|}{Mean}  \\
\multicolumn{1}{|c}{Source} & \multicolumn{1}{c}{Freedom ($df$)} &
\multicolumn{1}{c}{Squares} & \multicolumn{1}{c|}{Squares}  \\
\hline
 treatment  & $k-1$ & $SSTr  = \sum_{i=1}^{k} n_i {( \bar{y}_{i \cdot} - \bar{y}_{\cdot \cdot})}^{2}$ & $MSTr = SSTr/df$\\
 residual   & $N-k$ & $SSE  = \sum_{i=1}^{k}\sum_{j=1}^{n_i} {( y_{ij} - \bar{y}_{i \cdot})}^{2}   $ & $MSE = SSE/df$\\
 total      & $N-1$ & $\sum_{i=1}^{k}\sum_{j=1}^{n_i} {( y_{ij} - \bar{y}_{\cdot \cdot})}^{2}  $ & \\
 \hline
\end{tabular}
\label{tab:ANOVA} \large\normalsize
\end{table}

The $F$ statistic for the null hypothesis that there is no
difference between the treatments, i.e.,
\begin{eqnarray*}
 H_0: \tau_1 = \cdots  =  \tau_k, \label{eqn:tauEqual}
\end{eqnarray*}
is
\begin{eqnarray*}
\nonumber F = \frac {\sum_{i=1}^{k} n_i {( \bar{y}_{i \cdot} -
\bar{y}_{\cdot \cdot})}^{2}/(k-1)} {\sum_{i=1}^{k}
\sum_{j=1}^{n_i} {( y_{ij} - \bar{y}_{i
\cdot})}^{2}/(N-k)}=\frac{MSTr}{MSE} , \label{eqn:FoneWay}
\end{eqnarray*}
which has an $F$ distribution with parameters $k-1$ and $N-k$.

\es

%---------------------------------------------------------------------
% 5-------------------------------------------------------------------
\bs \heading{ANOVA for Pulp Experiment}

\begin{table}[htbp]
$ $\\
\large\small \centering
\begin{tabular} {|lcccc|}
\hline \multicolumn{1}{|c}{} & \multicolumn{1}{c}{Degrees of} &
\multicolumn{1}{c}{Sum of} &
\multicolumn{1}{c}{Mean} &
\multicolumn{1}{c|}{ } \\
\multicolumn{1}{|c}{Source} & \multicolumn{1}{c}{Freedom ($df$)} &
\multicolumn{1}{c}{Squares} & \multicolumn{1}{c}{Squares} &
\multicolumn{1}{c|}{F}  \\
\hline
 operator  & 3 & 1.34 & 0.447 & 4.20 \\
 residual   & 16 & 1.70 & 0.106 & \\
 total      & 19 & 3.04 & &\\
 \hline
\end{tabular}
\label{tab:ANOVA} \large\normalsize
\end{table}

 \bi
  \item $ Prob(F_{3,16} > 4.20)$ = 0.02 = p value, \\ thus
 declaring a significant operator-to-operator difference at level
 0.02.
  \item Further question: among the 6 = ${4\choose 2}$ pairs of operators, what
  pairs show significant difference? \\
  Answer: Need to use multiple comparisons.
 \ei

\es

%---------------------------------------------------------------------
% 6-------------------------------------------------------------------
\bs \heading{Multiple Comparisons}

 \bi
  \item For one pair of treatments, it is common to use the $t$ test
  and the $t$ statistic
  \begin{center}
$t_{ij}=\frac { \bar{y}_{j \cdot}-\bar{y}_{i \cdot}
}{\hat{\sigma}\sqrt{1/n_j + 1/n_i}},$ \\
  \end{center}
where $n_i =$ number of observations for treatment $i$,
$\hat{\sigma^2}= $ RSS/df in ANOVA; \\declare ``treatments $i$ and
$j$ different at level $\alpha$" if
\begin{center}
$|t_{ij}| > t_{N-k, \alpha/2}.$ \\
\end{center}

 \item Suppose $k'$ tests are performed to test $H_0 : \tau_1 = \cdots  =
 \tau_k$. \\ \emph{Experimentwise error rate} (EER) = Probability of
 declaring at least one pair of treatments significantly different
 under $H_0$. Need to use multiple comparisons to control EER.
\small
\begin{table}[htbp]
%\caption{Multiple Comparison $t$ Statistics, Pulp Experiment}
\begin{center}
\begin{tabular}{|cccccc|} \hline
\multicolumn{1}{|c}{A vs.\ B}  & \multicolumn{1}{c}{A vs.\ C}  &
\multicolumn{1}{c}{A vs.\ D}  & \multicolumn{1}{c}{B vs.\ C}  &
\multicolumn{1}{c}{B vs.\ D}  & \multicolumn{1}{c|}{C vs.\ D}  \\
\hline -0.87&1.85&2.14&2.72&3.01&0.29 \\ \hline
\end{tabular}
\end{center}
\label{tab:PulpTvalues}
\end{table}
\ei

\es

%---------------------------------------------------------------------
% 7-------------------------------------------------------------------
\bs \heading{Bonferroni Method}

\bi
 \item Declare
``$\tau_i$ different from $\tau_j$ at level $\alpha$" if $|t_{ij}|
> t_{N-k, \frac{\alpha}{2k'}}$, where $k'=$ no. of tests.

 \item For one-way layout with k treatments,
 $k'= \left( \begin{array}{c} k \\ 2 \end{array} \right) = \frac{1}{2}
 k(k-1)$, as k increases, $k'$ increases, and the critical value
 $t_{N-k, \frac{\alpha}{k'}}$ gets bigger \\
 (i.e., method less
 powerful in detecting differences).
 \item Advantage: It works without requiring independence
 assumption.
 \item For pulp experiment, take $\alpha=$0.05, $k=$4, $k'=$6,
 $t_{16,0.05/12}=$3.008. Among the 6 $t_{ij}$ values (see p.6),
 only the $t$ value for B-vs-D, 3.01, is larger. Declare ``B and
 D different at level 0.05".

 \ei

\es

%---------------------------------------------------------------------
% 8-------------------------------------------------------------------
\bs \heading{Tukey Method}

\bi
 \item Declare ``$\tau_i$ different from $\tau_j$ at level $\alpha$" if \\
  \bc
$|t_{ij}| > \frac{1}{\sqrt{2}} q_{k,N-k,\alpha},$ \\
  \ec
where $q_{k,N-k,\alpha}$ is the upper $\alpha$  point of the {\bf
Studentized range} distribution with parameter $k$ and $N-k$
degrees of freedom. (See distribution table on p.9.) Tony Hayter
proved that its EER is at most $\alpha$. (Proof in (2.21) not
required.)

 \item For pulp experiment, \begin{displaymath}
\frac{1}{\sqrt{2}} q_{k,N-k,0.05} = \frac{1}{\sqrt{2}}
q_{4,16,0.05} = \frac{4.05}{\sqrt{2}} = 2.86.
\end{displaymath}Again only B-vs-D has larger $t_{ij}$ value than
2.86 (See p.6). Tukey method is more powerful than Bonferroni
method because 2.86 is smaller than 3.01 (why?)

\ei


\es

%---------------------------------------------------------------------
% 9-------------------------------------------------------------------
\bs \heading{Selected values of $q_{k,\nu,\alpha}$ for
$\alpha=0.05$} \tiny
\begin{table}[hptb]
\begin{tabular}{|r|rrrrrrrrrrrrrr|} \hline
&\multicolumn{14}{c|}{$k$}\\
$\nu$&2&3&4&5&6&7&8&9&10&11&12&13&14&15
\\ \hline
  1&17.97&26.98&32.82&37.08&40.41&43.12&45.40&47.36&49.07&50.59&51.96&53.20&54.33&55.36\\
  2&6.08&8.33&9.80&10.88&11.74&12.44&13.03&13.54&13.99&14.39&14.75&15.08&15.38&15.65\\
  3&4.50&5.91&6.82&7.50&8.04&8.48&8.85&9.18&9.46&9.72&9.95&10.15&10.35&10.52\\
  4&3.93&5.04&5.76&6.29&6.71&7.05&7.35&7.60&7.83&8.03&8.21&8.37&8.52&8.66\\
  5&3.64&4.60&5.22&5.67&6.03&6.33&6.58&6.80&6.99&7.17&7.32&7.47&7.60&7.72\\
  6&3.46&4.34&4.90&5.30&5.63&5.90&6.12&6.32&6.49&6.65&6.79&6.92&7.03&7.14\\
  7&3.34&4.16&4.68&5.06&5.36&5.61&5.82&6.00&6.16&6.30&6.43&6.55&6.66&6.76\\
  8&3.26&4.04&4.53&4.89&5.17&5.40&5.60&5.77&5.92&6.05&6.18&6.29&6.39&6.48\\
  9&3.20&3.95&4.41&4.76&5.02&5.24&5.43&5.59&5.74&5.87&5.98&6.09&6.19&6.28\\
 10&3.15&3.88&4.33&4.65&4.91&5.12&5.30&5.46&5.60&5.72&5.83&5.93&6.03&6.11\\
 11&3.11&3.82&4.26&4.57&4.82&5.03&5.20&5.35&5.49&5.61&5.71&5.81&5.90&5.98\\
 12&3.08&3.77&4.20&4.51&4.75&4.95&5.12&5.27&5.39&5.51&5.61&5.71&5.80&5.88\\
 13&3.06&3.73&4.15&4.45&4.69&4.88&5.05&5.19&5.32&5.43&5.53&5.63&5.71&5.79\\
 14&3.03&3.70&4.11&4.41&4.64&4.83&4.99&5.13&5.25&5.36&5.46&5.55&5.64&5.71\\
 15&3.01&3.67&4.08&4.37&4.59&4.78&4.94&5.08&5.20&5.31&5.40&5.49&5.57&5.65\\
 16&3.00&3.65&4.05&4.33&4.56&4.74&4.90&5.03&5.15&5.26&5.35&5.44&5.52&5.59\\
 \hline \end{tabular}
\\$\alpha$=upper tail probability, $\nu$=degrees of freedom,
$k$=number of treatments
\end{table}

\normalsize For complete tables corresponding to various values of
$\alpha$ refer to Appendix E.\es
%---------------------------------------------------------------------
% 10-------------------------------------------------------------------
\bs \heading{One-Way ANOVA with a Quantitative Factor}

\bi
 \item {\bf Data :}
 \begin{eqnarray*}
 y &=& \mbox{bonding strength of composite material,}\\
 x &=& \mbox{laser power at 40, 50, 60 watt.}
 \end{eqnarray*}

\begin{table}[htbp]
\caption{Strength Data, Composite Experiment}
\begin{center}
\label{tab:composite}
\begin{tabular}{|rrr|} \hline
\multicolumn{3}{|c|}{Laser Power (watts)} \\
\multicolumn{1}{|c}{40}  & \multicolumn{1}{c}{50}  &
\multicolumn{1}{c|}{60}  \\ \hline
25.66&29.15&35.73\\
28.00&35.09&39.56\\
20.65&29.79&35.66\\ \hline
\end{tabular}
\end{center}
\end{table}
\ei \es


%---------------------------------------------------------------------
% 11-------------------------------------------------------------------
\bs \heading{One-Way ANOVA %with a Quantitative Factor
(Contd)}

\begin{table}[htbp]
\caption{ANOVA Table, Composite Experiment}
\label{tab:compositeAnova}
%$ $\\
%\large\small
\centering
\begin{tabular} {|lrrrr|} \hline
\multicolumn{1}{|c}{} & \multicolumn{1}{c}{Degrees of} &
\multicolumn{1}{c}{Sum of} & \multicolumn{1}{c}{Mean}  &
\multicolumn{1}{c|}{}  \\
\multicolumn{1}{|c}{Source} & \multicolumn{1}{c}{Freedom} &
\multicolumn{1}{c}{Squares} & \multicolumn{1}{c}{Squares}  &
\multicolumn{1}{c|}{$F$}  \\ \hline
laser& 2 & 224.184 &112.092&11.32\\
residual &6& 59.422 & 9.904 & \\
total & 8& 283.606 & &\\
\hline
\end{tabular}
%\large\normalsize
\end{table}

\bi \item Conclusion from ANOVA : Laser power has a significant
effect on strength.
 \item To further understand the effect, use of multiple
 comparisons is not useful here. ( Why? )
 \item The effects of a quantitative factor like laser power can
 be decomposed into linear, quadratic, etc.
 \ei


\es

%---------------------------------------------------------------------
% 12-------------------------------------------------------------------
\bs \heading{Linear and Quadratic Effects}

\bi \item Suppose there are three levels of $x$ (low, medium,
 high) and the corresponding $y$ values are $y_1, y_2, y_3$.

  \[
  \mbox{Linear contrast : } y_3 -y_1 =
  \big( \mbox{-1}, 0, 1 \big)
  \left(
    \begin{array}{c}
    y_1\\
    y_2\\
    y_3
    \end{array}
  \right).
  \]


  \[
  \mbox{Quadratic contrast : } y_1 -2y_2 + y_3 =
  \big( 1, \mbox{-2}, 1 \big)
  \left(
    \begin{array}{c}
    y_1\\
    y_2\\
    y_3
    \end{array}
  \right).
  \]


 (-1,0,1) and (1,-2,1) are the linear and quadratic contrast
 vectors; \\ they  are \textbf{orthogonal} to each other.

  \ei
\es



%---------------------------------------------------------------------
% 13-------------------------------------------------------------------

\bs \heading{Linear and Quadratic Effects (Contd.)}

\vspace{0.2 in}

 \bi \item Using (-1,0,1) and (1,-2,1), we can write a
more detailed regression model $y=X\beta+\epsilon$, where the
model matrix $X$ is given as in (2.26).

 \item {\textit{ Normalization :} } Length of $(-1,0,1) = \sqrt 2$, length of $(1,-2,1) = \sqrt
 6$, divide each vector by its length in the regression model. (Why
 ? It provides a {\it consistent} comparison of the regression
 coefficients. But the $t$-statistics in the next table are
 independent of such (and any) scaling.)
\item Normalized contrast vectors:\\
linear: $ $ $ $ $ $ $ $ $ $ $ $ $(-1,0,1)/\sqrt2=(-1/\sqrt2,0,1/\sqrt2),$\\
quadratic: $(1,-2,1)/\sqrt6=(1/\sqrt6,-2/\sqrt6,1/\sqrt6).$
 \ei
 \es

%---------------------------------------------------------------------
% 17 -----------------------------------------------------------------

\bs \heading{Estimation of Linear and Quadratic Effects} \small

%\begin{equation*}
%\scriptsize \left(\begin{array}{c} 25.66\\29.15\\35.73\\
%28.00\\35.09\\39.56\\
%20.65\\29.79\\35.66\end{array}\right) =
%\left(\begin{array}{ccc} 1& -1/\sqrt{2}& 1/\sqrt{6}\\
%                         1& 0/\sqrt{2}& -2/\sqrt{6}\\
%                         1& 1/\sqrt{2}&  1/\sqrt{6}\\
%                         1& -1/\sqrt{2}& 1/\sqrt{6}\\
%                         1& 0/\sqrt{2}& -2/\sqrt{6}\\
%                         1& 1/\sqrt{2}&  1/\sqrt{6}\\
%                         1& -1/\sqrt{2}& 1/\sqrt{6}\\
%                         1& 0/\sqrt{2}& -2/\sqrt{6}\\
%                         1& 1/\sqrt{2}&  1/\sqrt{6}\\
%                         \end{array}\right)
%\left(\begin{array}{c} \beta_{0}\\ \beta_{l}\\
%\beta_{q} \end{array}\right)
%\end{equation*}

 \bi
    \item Let $\beta_{0}$, $\beta_{l}$, $\beta_{q}$ denote
    respectively the intercept, the linear effect and the
    quadratic effect and let $\mathbf{\beta}=(\beta_{0}, \beta_{l}, \beta_{q})^\prime$.
    An estimator $\hat{\mathbf{\beta}}$ of $\mathbf{\beta}$ based
    on normalized constrasts for the mean, linear, and quadratic effects is given by
\begin{equation*}
\scriptsize \hat{\mathbf{\beta}}=\left(\begin{array}{c} \hat{\beta_{0}}\\ \hat{\beta_{l}}\\
\hat{\beta_{q}}\end{array}\right) =
\left(\begin{array}{ccc} 1/\sqrt{3}& 1/\sqrt{3} & 1/\sqrt{3}\\
                         -1/\sqrt{2}& 0 & 1/\sqrt{2}\\
                         1/\sqrt{6}& -2/\sqrt{6} & 1/\sqrt{6}\\
                         \end{array}\right)
\left(\begin{array}{c} y_1\\ y_2\\
y_3 \end{array}\right)
\end{equation*}
\item We can write $\hat{\mathbf{\beta}} =
\mathbf{X^\prime}\mathbf{y}$, where
\begin{equation*}
\scriptsize \mathbf{X} =
\left(\begin{array}{ccc} 1/\sqrt{3}& -1/\sqrt{2} & 1/\sqrt{6}\\
                         1/\sqrt{3}& 0 & -2/\sqrt{6}\\
                         1/\sqrt{3}& 1/\sqrt{2} & 1/\sqrt{6}\\
                         \end{array}\right)
\end{equation*}
    \item Since the columns of $\mathbf{X}$ constitute a set of orthonormal vectors, i.e.
$\mathbf{X^\prime}\mathbf{X}= I$, we have
$$\hat{\mathbf{\beta}} = \mathbf{X^\prime}\mathbf{y} = (\mathbf{X^\prime}\mathbf{X})^{-1}
    \mathbf{X^\prime}\mathbf{y}.$$
This shows that $\hat{\mathbf{\beta}}$ is {\it identical to the
least squares estimate of} $\mathbf{\beta}$.
    \item Running a multiple linear regression with response
    $y$ and predictors $x_l$ and $x_q$, we get $\hat{\beta}_0 = 31.0322, \; \hat{\beta}_l = 8.636, \;
\hat{\beta}_q = -0.381$.
  \ei

\normalsize \es

%---------------------------------------------------------------------
% 14-------------------------------------------------------------------

\bs \heading{Tests for Linear and Quadratic Effects}


\begin{table}[htbp]
\caption{Tests for Polynomial  Effects, Composite Experiment}
\begin{center}
\begin{tabular}{|lrrrr|} \hline
\multicolumn{1}{|c}{} & \multicolumn{1}{c}{} &
\multicolumn{1}{c}{Standard} & \multicolumn{1}{c}{} &
\multicolumn{1}{c|}{} \\
\multicolumn{1}{|c}{Effect} & \multicolumn{1}{c}{Estimate} &
\multicolumn{1}{c}{Error} & \multicolumn{1}{c}{$t$} &
\multicolumn{1}{c|}{p-value}\\ \hline
linear    & 8.636 &   1.817  &    4.75 &   0.003 \\
quadratic &-0.381 &   1.817  & -0.21   & 0.841 \\ \hline
\end{tabular}
\end{center}
\label{tab:compositeTests}
\end{table}

 \bi \item Further conclusion : Laser power has a significant
 linear (but not quadratic) effect on strength.

 \item Another question : How to predict $y$-value (strength) at a
 setting not in the experiment (i.e., other than 40, 50, 60) ?
 Need to extend the concept of linear and quadratic contrast vectors
 to cover a {\it whole interval} for $x$. This requires building a model using polynomials.
\ei
 \es


%---------------------------------------------------------------------
% 15-------------------------------------------------------------------

\bs \heading{Orthogonal Polynomials}

\bi
 \item For three evenly spaced levels $m - \Delta$, $m$, and
$m + \Delta$, define the first and second degree polynomials :
\begin{eqnarray*}
 P_1 (x) &=& \frac{x - m}{\Delta} ,\;\;  \mbox{ ( = -1, 0 and 1,
 for $x = m - \Delta, m,  m + \Delta$ ), } \\
 P_2 (x) &=& 3 \left[{ {\left( \frac{x - m}{\Delta} \right)}^2 -
 \frac{2}{3}}\right] \;\; \mbox{ ( = 1, -2 and 1,  for $x = m -
 \Delta, m,  m + \Delta$ ), }.
\end{eqnarray*}

Therefore, $P_1(x)$ and $P_2(x)$ are extensions of the linear and
quadratic contrast vectors. (Why ?)

 \item {\bf Polynomial regression model : }
\begin{eqnarray*}
 y = \beta_0 + \beta_1 P_1 (x)\slash \sqrt{2} + \beta_2
P_2 (x)\slash \sqrt{6} + \epsilon, \label{eqn:quadraticModel}
\end{eqnarray*}
obtain regression (i.e., least squares) estimates $\hat{\beta}_0 =
31.03$, $\hat{\beta}_1 = 8.636$,  $\hat{\beta}_2 = -0.381$. ( Note
: $\hat{\beta}_1$ and $\hat{\beta}_2$ values are same as in Table
4).

  \ei \es

%---------------------------------------------------------------------
% 16-------------------------------------------------------------------

\bs \heading{Prediction based on Polynomial Regression Model}

\bi
 \item Fitted model:
 \begin{eqnarray*}
\hat{y} = 31.0322 + 8.636 P_1(x)/\sqrt{2} \nonumber
 -0.381 P_2(x)/\sqrt{6} ,
\end{eqnarray*}

 \item To predict  $\hat{y}$ at any $x$, plug in the $x$ on the
 right side
 of the regression equation. For $x = 55 = 50+\frac{1}{2}10, m = 50, \Delta =
 10,$

 \[P_1(55)=\frac{55-50}{10}=\frac{1}{2}, \]
\[P_2(55)=3\left[\left(\frac{55-50}{10}\right)^2 -\frac{2}{3}\right]=-\frac{5}{4},\]

\begin{eqnarray*}
\hat{y} & = &
31.0322+8.636(0.3536)-0.381(-0.5103) \nonumber \\
& = & 34.2803.
\end{eqnarray*}

\ei \es


%---------------------------------------------------------------------
% 18-------------------------------------------------------------------

\bs \heading{Residual Analysis: Theory}

\bi
 \item Theory: define the \textbf{residual} for the $i^{th}$ observation
 $x_i$ as \\ \bc $r_i = y_i - \hat{y_i}, \hspace{.2 in} \hat{y_i} = x_i^T
 \hat{\beta},$ \ec
 $\hat{y_i}$ contains information given by the model; $r_i$ is the
 ``difference" between $y_i$ (observed) and $\hat{y_i}$(fitted) and
contains information on  possible \emph{model inadequacy}.

Vector of residuals $\mathbf{r} = \{r_i\}_{i=1}^{N} =
\mathbf{y-X\hat{\beta}}.$

\item Under the model assumption $E\mathbf{(y)} =
\mathbf{X\beta}$, it can be shown that \\(a) $E(\mathbf{r})=0$,\\
(b) $\mathbf{r}$ and $\mathbf{\hat{y}}$ are independent,\\ (c)
variances of $r_i$ are nearly constant for ``nearly balanced"
designs.

 \ei
 \es

%---------------------------------------------------------------------
% 19-------------------------------------------------------------------

\bs \heading{Residual Plots}

\bi

\item Plot $r_i$ vs. $\hat{y}_i$ (see Figure 1): It should appear
as a parallel band around 0. Otherwise, it would suggest model
violation. If spread of $r_i$ increases as $\hat{y}_i$ increases,
error variance of $y$ increases with mean of $y$. Need a
transformation of $y$. (Will be explained in Unit 3.)

\item  Plot $r_i$ vs. $x_i$ (see Figure 2): If not a parallel band
around 0, relationship between $y_i$ and $x_i$ not fully captured,
revise the $X\beta$ part of the model.

\item Plot $r_i$ vs. time sequence: to see if there is a time
trend or autocorrelation over time.

\item Plot $r_i$ from replicates per treatment: to see if error
variance depends on treatment.

\ei \es

%---------------------------------------------------------------------
% 20 -------------------------------------------------------------------

\bs
  \heading{Plot of $r_i$ vs.\ $\hat{y}_i$}
  \begin{figure}[htbp]
  \centerline{\psfig{figure=picture/pulpyhatres.ps,width=2.5in,height=2.5in,angle=-90}}
%\centerline{\psfig{figure=C:/tirtha/jeffcourse/isye6413/picture/pulpyhatres.ps,width=2.5in,height=2.5in,angle=-90}}
\caption{$r_i$ vs.\ $\hat{y}_i$, Pulp Experiment}
\label{fig:pulpyhatvsres}
\end{figure}
\es



%---------------------------------------------------------------------
% 21 -------------------------------------------------------------------

\bs
  \heading{Plot of $r_i$ vs.\ $x_i$}
\begin{figure}[htbp]
\centerline{\psfig{figure=picture/pulpxvsres.ps,width=2.5in,height=2.5in,angle=-90}}
%\centerline{\psfig{figure=C:/tirtha/jeffcourse/isye6413/picture/pulpxvsres.ps,width=2.5in,height=2.5in,angle=-90}}
\caption{$r_i$ vs.\ $x_i$, Pulp Experiment} \label{fig:pulpxvsres}
\end{figure}
\es




%---------------------------------------------------------------------
% 22 -------------------------------------------------------------------
\bs \heading{Box-Whisker Plot} \bi

\item  A powerful graphical display (due to Tukey) to capture the
location, dispersion, skewness and extremity of a distribution.
See Figure~3.

\item $Q_1=$ lower quartile ($25^{th}$ percentile), $Q_3=$ upper
quartile ($75^{th}$ percentile), $Q_2=$ median ($location$) is the
white line in the box. $Q_1$ and $Q_3$ are boundaries of the
\textit{black box}.



$IQR$ = interquartile range (length of box) = $Q_3$ - $Q_1$ is a
measure of $dispersion$.\\ Minimum and maximum of
\textbf{observed} values within $[Q_1- 1.5IQR, Q_3+ 1.5IQR]$ are
denoted by two \textit{whiskers}. Any values outside the whiskers
are $outliers$ and are displayed.

\item If $Q_1$ and $Q_3$ are not symmetric around the median, it
indicates {\it skewness}. \ei

\es

%---------------------------------------------------------------------
% 23 -------------------------------------------------------------------




\bs
  \heading{Box-Whisker Plot}
\begin{figure}[htbp]
\centerline{\psfig{figure=picture/boxpot.eps,width=2.5in,height=2in,angle=0}}
%\centerline{\psfig{figure=C:/tirtha/jeffcourse/isye6413/picture/boxplot.ps,width=2.5in,height=2.5in,angle=-90}}
\caption{Box-Whisker Plot} \label{fig:boxplot}
\end{figure}
\es



%---------------------------------------------------------------------
% 24 -----------------------------------------------------------------


\bs
  \heading{Normal Probability Plot}
\bi

\item Original purpose : To test if a distribution is normal,
e.g., if the residuals follow a normal distribution (see
Figure~5). More powerful use in factorial experiments (will be
discussed in Units~4 and~5).

\item Let $r_{(1)} \le \ldots \le r_{(N)}$ be the ordered
residuals. The cumulative probability for $r_{(i)}$ is $p_i =
(i-0.5)/N$. Thus the plot of $p_i$ vs. $r_{(i)}$ should be
S-shaped as in Figure~4(a) if the errors are normal. By
transforming the scale of the horizontal axis, the S-shaped curve
is straightened to be a line (see Figure~4(b)).

\item {\bf Normal probability plot} of residuals : $$\left(
\Phi^{-1}(p_i),r_{(i)}\right), \hspace{.2 in}i=1,\ldots,N,
\hspace{0.2 in} \Phi = \mbox{normal cdf}.$$ If the errors are
normal, it should plot roughly as a straight line. See Figure~5.
\ei
 \es



%---------------------------------------------------------------------
% 25 -------------------------------------------------------------------

\bs
  \heading{Regular and Normal Probability Plots of Normal CDF}
\begin{figure}[htbp]
\centerline{\psfig{figure=picture/fig18.ps,width=2.5in,height=4.5in,angle=-90}}
%\centerline{\psfig{figure=C:/tirtha/jeffcourse/isye6413/picture/fig18.ps,width=2.5in,height=4.5in,angle=-90}}
 \caption{Normal Plot of $r_i$, Pulp Experiment}
 \label{fig:pulpnpres}
\end{figure}
\es


%---------------------------------------------------------------------
% 26 -------------------------------------------------------------------

\bs
  \heading{Normal Probability Plot : Pulp Experiment}
\begin{figure}[htbp]
\centerline{\psfig{figure=picture/pulpnpres.ps,width=2.5in,height=2.5in,angle=-90}}
%\centerline{\psfig{figure=C:/tirtha/jeffcourse/isye6413/picture/pulpnpres.ps,width=2.5in,height=2.5in,angle=-90}}
\caption{Normal Plot of $r_i$, Pulp Experiment}
\label{fig:pulpnpres}
\end{figure}
\es



%---------------------------------------------------------------------
% 27 -------------------------------------------------------------------

\bs
  \heading{Pulp Experiment Revisited}

\bi
 \item  In the pulp experiment the effects ${\tau}_i$ are called {\em fixed} effects
    because the interest was in comparing the four \emph{specific} operators in the study.
    If these four operators were chosen randomly from the population of operators in
    the plant, the interest would usually be in the variation among all operators in
    the population. Because the observed data are from operators randomly selected
    from the population, the variation among operators in the {\it population} is referred to
    as {\em random} effects.
 \item  {\bf One-way random effects model :}
  $$y_{ij} = \eta + \tau_i + \epsilon_{ij},$$
$\epsilon_{ij}$'s are independent error terms with
$N(0,\sigma^2)$, $\tau_i$ are independent $N(0,\sigma_{\tau}^2)$,
and $\tau_i$ and $\epsilon_{ij}$ are independent (Why? Give an
example.); $\sigma^2$ and $\sigma_{\tau}^2$ are the two
\textit{variance components} of the model. The variance among
operators in the population is measured by $\sigma_{\tau}^2$. \ei
\es



%---------------------------------------------------------------------
% 28 -------------------------------------------------------------------

\bs
  \heading{One-way Random Effects Model: ANOVA and Variance
  Components}
\bi

\item The null hypothesis for the fixed effects model: ${\tau}_1 =
\cdots = {\tau}_k$ should be replaced by
$$H_0: \sigma_\tau^2 = 0.$$
Under $H_0$, the $F$ test and the ANOVA table in Section~2.1 still
holds.

Reason: under $H_0$, $SSTr \sim \sigma^2 \chi^2_{k-1} $ and $SSE
\sim \sigma^2 \chi^2_{N-k}$. Therefore the $F$-test has the
distribution $F_{k-1,N-k}$ under $H_0$.


 \item We can apply the {\em same} ANOVA and $F$ test in the fixed effects case for
    analyzing data. For example, using the results in Section 2.1, the $F$ test has
    value 4.2 and thus $H_0$ is rejected at level 0.05. However, we need to compute
    the expected mean squares under the alternative of $\sigma^2_\tau> 0$, \\
    (i) for sample size determination, and\\
    (ii) to estimate the variance components.

 \ei
\es



%---------------------------------------------------------------------
% 29 -------------------------------------------------------------------

\bs
  \heading{Expected Mean Squares for Treatments}

\bi \item Equation~(\ref{eqn:1}) holds independent of
$\sigma^2_\tau$,
\begin{eqnarray}\label{eqn:1}
E(MSE)=E\left(\frac{SSE}{N-k}\right)=\sigma^2.
\end{eqnarray}

 \item Under the alternative: $\sigma^2_\tau > 0$, and for
$n_i=n$,
  \begin{eqnarray}\label{eqn:2}
E(MSTr)=E\left(\frac{SSTr}{k-1}\right)=\sigma^2+n\sigma_\tau^2.
\end{eqnarray}


For unequal $n_i$'s, $n$ in (\ref{eqn:2}) is replaced by
$$n^\prime = \frac{1}{k-1}\left[ \sum_{i=1}^kn_i - \frac{\sum_{i=1}^k n_i^2}{\sum_{i=1}^kn_i}\right].$$




\ei \es


%---------------------------------------------------------------------
% 30 -------------------------------------------------------------------

\bs
  \heading{Proof of (\ref{eqn:2})}

\begin{eqnarray*}
 \bar{y}_{i.}-\bar{y}_{..} &=& \Big( \tau_i - \bar{\tau_.}\Big) + \Big(\bar{\epsilon}_{i}.-\bar{\epsilon}_{..}\Big)\\
                       SSTr &=& \sum_{i=1}^k n \Big( \bar{y}_{i.}-\bar{y}_{..}\Big)^2\\
                           &=& n\Big\{ \sum\big( \tau_i - \bar{\tau_.} \big)^2 + \sum\big(\bar{\epsilon}_{i.} - \bar{\epsilon}_._. \big)^2 + 2 \sum\big( \bar{\epsilon}_{i.} -\bar{\epsilon}_._. \big)\big( \tau_i - \bar{\tau_.}\big)
                           \Big\}.
\end{eqnarray*}

The cross product term has mean 0 (because $\tau$ and $\epsilon$
are independent). It can be shown that
\begin{eqnarray*}
E\Big(\sum_{i=1}^k \big( \tau_i - \bar{\tau_.}\big)^2\Big) =
(k-1)\sigma^2_\tau &\mbox{and}& E\Big(\sum_{i=1}^k \big(
\bar{\epsilon}_{i.} - \bar{\epsilon}_._. \big)^2\Big) =
\frac{(k-1)\sigma^2}{n}.
\end{eqnarray*}

Therefore \begin{eqnarray*} E(SSTr) &=& n(k-1)\sigma^2_\tau +
(k-1)\sigma^2,\\
E(MSTr) &=& E\left( \frac{SSTr}{k-1}\right) = \sigma^2 +
n\sigma^2_\tau.
\end{eqnarray*}

 \es



%---------------------------------------------------------------------
% 31-------------------------------------------------------------------

\bs

\heading{ANOVA Tables ($n_i = n$)}

\large\small \centering
\begin{tabular} {|llllc|}
\hline
Source & d.f. & SS & MS & E(MS)  \\
\hline
 treatment  & $k-1$ & $SSTr$ & $MSTr = \frac{SSTr}{k-1}$ & $\sigma^2 + n\sigma^2_\tau$\\
 residual   & $N-k$ & $SSE$ & $MSE = \frac{SSE}{N-k}$ & $\sigma^2$\\
 total      & $N-1$ &  &  & \\
 \hline
\end{tabular}

\vspace{0.2 in}
\begin{center}
Pulp Experiment \vspace{0.01 in}

\begin{tabular} {|ccccc|}
\hline
Source & d.f. & SS & MS & E(MS)  \\
\hline
 treatment  & $ 3$ & 1.34 & 0.447 & $\sigma^2 + 5\sigma^2_\tau$\\
 residual   & $16$ & 1.70 & 0.106 & $\sigma^2$\\
 total      & $19$ & 3.04 &  & \\
 \hline
\end{tabular}
\end{center}
\es



%---------------------------------------------------------------------
% 32 -----------------------------------------------------------------

\bs
  \heading{Estimation of $\sigma^2$ and $\sigma^2_\tau$}

\bi

 \item From equations (1) and (2), we obtain the following unbiased estimates of the
    variance components:
\begin{eqnarray*}
 \hat{\sigma}^2 = MSE &\mbox{and}& \hat{\sigma}^2_\tau = \frac{MSTr -MSE}{n}.
\end{eqnarray*}

Note that $\hat{\sigma}^2_\tau \ge 0$ if and only if $MSTr \ge
MSE$, which is equivalent to $F \ge 1$. Therefore a {\em negative}
variance estimate ${\hat{\sigma}^2}_\tau$ occurs only if the value
of the $F$ statistic is less than 1. Obviously the null hypothesis
$H_0$ is not rejected when $F \le 1$. Since variance cannot be
negative, a negative variance estimate is replaced by 0. This does
not mean that $\sigma^2_\tau$ is zero. It simply means that there
is not enough information in the data to get a good estimate of
$\sigma^2_\tau$.

\item  For the pulp experiment, $n = 5$, $\hat{\sigma}^2$ = 0.106,
$\hat{\sigma}^2_\tau$ = $(0.447 - 0.106)/5$ = 0.068, i.e.,
sheet-to-sheet variance
    (within same operator) is 0.106, which is about 50\% higher than operator-to-operator variance 0.068.

{\it Implications on process improvement} (discuss in class) : try
to reduce the two sources of variation, also considering costs.

\ei \es




%---------------------------------------------------------------------
% 33 -----------------------------------------------------------------

\bs
  \heading{Estimation of Overall Mean $\eta$}

\bi
 \item In random effects  model, $\eta$, the population mean, is often of interest.\\
 From $E(y_{ij})=\eta$, we use the estimate
 $$\hat{\eta}=\bar{y}_{..} \mbox{\hspace{0.1 in}.}$$
\item $Var(\hat{\eta}) =
Var(\bar{\tau}_.+\bar{\epsilon}_{..})=\frac{\sigma^2_\tau}{k}+\frac{\sigma^2}{N}$,
where $N=\sum_{i=1}^k n_i$. \\

For $n_i=n$,  $Var(\hat{\eta}) =
\frac{\sigma^2_\tau}{k}+\frac{\sigma^2}{nk} = \frac{1}{nk}\left(
\sigma^2+n\sigma_\tau^2\right)$.

Using~(\ref{eqn:2}), $\frac{MSTr}{nk}$ is an unbiased estimate of
$Var(\hat{\eta})$. Confidence interval for $\eta$:
$$\hat{\eta}\pm t_{k-1,\frac{\alpha}{2}}\sqrt{\frac{MSTr}{nk}}$$

\item In the pulp experiment, $\hat{\eta}=60.40$, $MSTr=0.447$,
and the 95\% confidence interval for $\eta$ is $$60.40\pm
3.182\sqrt{\frac{0.447}{5\times 4}} = [59.92,60.88].$$\ei

\es


%---------------------------------------------------------------------
% last ---------------------------------------------------------------

\bs
  \heading{Comments on Board}

 \vspace{3 in} \es




\end{document}
