%                               Blocking for STA305 (Experimental Design)
% Notes and comments at the end

% \documentclass[serif]{beamer} % Serif for Computer Modern math font.
\documentclass[serif, handout]{beamer} % Handout mode to ignore pause statements
\hypersetup{colorlinks,linkcolor=,urlcolor=red}


%  To create handout using article mode: Comment above and uncomment below (2 places)
%\documentclass[12pt]{article}
%\usepackage{beamerarticle}
%\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=red]{hyperref}   
     % For live Web links with href in article mode
%\usepackage{fullpage}
 

\usefonttheme{serif} % Looks like Computer Modern for non-math text -- nice!
\setbeamertemplate{navigation symbols}{} % Supress navigation symbols
\usetheme{Berlin} % Displays sections on top
\usepackage[english]{babel}
% \definecolor{links}{HTML}{2A1B81}
% \definecolor{links}{red}

\setbeamertemplate{footline}[frame number] 

\mode<presentation>
% \mode<handout>{\setbeamercolor{background canvas}{bg=black!5}}



\title{Randomized Block Designs\footnote{See last slide for copyright information.}}
\subtitle{STA305 Winter 2014}
\date{} % To suppress date


\begin{document}


\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
\frametitle{Background Reading} % 694-697
\framesubtitle{Optional} 
  \begin{itemize}
    \item Photocopy 2 from an old textbook; see course website. It's only four pages.
    \item The Wikipedia has a page that's okay, but it's not as clear as the old textbook.
  \end{itemize}
\end{frame}

\begin{frame}
\frametitle{Goal of Blocking}
\begin{itemize}
     \item Goal is increased precision, like the analysis of covariance.
     \item In  ANCOVA, random assignment to treatments ensures that covariates are statistically independent of the experimental treatment.
     \item But there could still be some relationship between treatment and covariates in the sample, just by chance.
     \item Example: More older people could wind up in the placebo group just by luck.
     \item Blocking aims to reduce this source of noise through the \emph{design}.
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Basic idea}
%\framesubtitle{} 
\begin{itemize}
    \item Blocking variables, like covariates, are nuisance variables that are known to be strongly associated with the response.
    \item For example
        \begin{itemize}
            \item Some parts of a field are just more fertile; crops \emph{always} grow better there.
            \item Some waiters always get more tips.
            \item Some high schools always get higher test scores.
        \end{itemize}
    \item[]
    \item So randomly assign experimental units to treatments \emph{within blocks}.
    \item One full set of treatments for each block is called a ``complete block design."
\end{itemize}

\end{frame}

\begin{frame}
\frametitle{Examples}
\framesubtitle{Randomly assign experimental units to treatments within blocks.}
  \begin{itemize}
    \item Compare two contact lens cleaning solutions. Block is the person. For each person, randomly assign one eye to each treatment.
    \item Compare $p$ crop fertilizers. Divide available land into \emph{blocks}, subdivide each block into $p$ plots, and randomly assign plots to fertilizers within each block. 
    \item Compare three programs for training kindergarten teachers in music. For a set of schools with at least three kindergarten classrooms, randomly choose three if necessary, and then randomly assign one of the three teachers to each training program, within each school. 
  \end{itemize}
\end{frame}

\begin{frame}
\frametitle{More examples}
%\framesubtitle{} 
\begin{itemize}
    \item Compare four off-season training programs for high school basketball teams. Sort the teams according to won-lost record last season, and then divide into blocks of four teams with similar (though not identical) records. Randomly assign teams to programs, within each block. 
    \item Assess the effect of chocolate cake recipe on amount of tip at a restaurant. The waiter recommends the cake and says there's a special low price (a lie). For each waiter separately, tables are randomly assigned to one of three recipes, in blocks of $3!=6$ consecutive tables. 
    \item In the last example, there were two blocking variables, waiter and order (time). There could be multiple sets of six for each waiter: a ``generalized" block design. 
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Counting problems}
%\framesubtitle{} 
Suppose there are $p$ treatments, arranged in a complete randomized block design with $k$ blocks. This means each treatment appears exactly once within each block.  
\begin{itemize}
    \item How many experimental units are required? % pk
    \item In how many ways can the units within each block be assigned to experimental treatments? % p!
    \item In how many total ways can the experimental units be assigned to treatments? % (p!)^k
    \item What is the maximum number of values in the permutation distribution of the test statistic? % (p!)^k
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Statistical model}
\framesubtitle{$F$-tests are approximations of the permutation tests} 
Ordinary factorial ANOVA (regression) model, but with \emph{no interactions between blocks and treatments}.

\vspace{4mm}

\begin{itemize}
    \item Consider $p$ treatments arranged in a complete randomized block design with $k$ blocks, so that each treatment appears exactly once within each block.
    \item $n=pk$, and total $df=pk-1$.
    \item Fill in the degrees of freedom for an ANOVA summary table.
    \item Make rows for Blocks, Treatments, Blocks $\times$ Treatments, Error, and Total$=pk-1$. Fill in the other numbers. 
    \item This is why there is no interaction between blocks and treatments.
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Generalized randomized block design}
%\framesubtitle{} 
\begin{itemize}
    \item More than one (full) set of experimental treatments in each block.
    \item Block is just another factor, though it's observed rather than manipulated.
    \item Interactions are testable.
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Latin Square designs}
\framesubtitle{Two blocking variables} 
{\Huge
\begin{center}
\begin{tabular}{|c|c|c|c|}  \hline
A & B & C & D  \\ \hline
B & A & D & C  \\ \hline
C & D & A & B  \\ \hline
D & C & B & A  \\ \hline
\end{tabular}
\end{center}
} % End size
\end{frame}

\begin{frame}
\frametitle{There can be both blocking and covariates in the same experiment}
For example,
\begin{itemize}
    \item Milk cows are randomly assigned to different types of feed. Response variable is volume of milk produced.
    \item Age of cow is the blocking variable: Important.
    \item Weight is important too, but it's hard to block on weight and age at the same time.
    \item Make weight a covariate.
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{frame}
\frametitle{Copyright Information}

This slide show was prepared by  \href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner},
Department of Statistics, University of Toronto. It is licensed under a 
\href{http://creativecommons.org/licenses/by-sa/3.0/deed.en_US}
     {Creative Commons Attribution - ShareAlike 3.0 Unported License}. Use any part of it as you like and share the result freely. The \LaTeX~source code is available from the course website:
\href{http://www.utstat.toronto.edu/~brunner/oldclass/305s14} {\footnotesize \texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/305s14}}

\end{frame}


\end{document}




\begin{frame}
\frametitle{Latin Square designs}
\framesubtitle{Two blocking variables} 
\begin{center}
\begin{tabular}{|c|c|c|c|} \\ \hline
1 & 2 & 3 & 4  \\ \hline
2 & 1 & 4 & 3  \\ \hline
3 & 4 & 1 & 2  \\ \hline
4 & 3 & 2 & 1  \\ \hline
\end{tabular}
\end{center}

\end{frame}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{}
%\framesubtitle{} 
\begin{itemize}
    \item 
    \item 
    \item 
\end{itemize}
\end{frame}














