\documentclass[serif]{beamer} % Get Computer Modern math font.
\hypersetup{colorlinks,linkcolor=,urlcolor=red}


\usefonttheme{serif} % Looks like Computer Modern for non-math text -- nice!
\setbeamertemplate{navigation symbols}{} % Suppress navigation symbols
% \usetheme{Berlin} % Displays sections on top
\usetheme{Frankfurt}  % Displays section titles on top: Fairly thin but still swallows some material at bottom of crowded slides
%\usetheme{Berkeley}

\usepackage[english]{babel}
\usepackage{amsmath} % for binom
% \usepackage{graphicx} % To include pdf files!
% \definecolor{links}{HTML}{2A1B81}
% \definecolor{links}{red}
\setbeamertemplate{footline}[frame number] 

\mode<presentation>

\title{The Pinwheel Model\footnote{See last slide for copyright information.}}
\subtitle{STA431 Winter/Spring 2015}
\date{} % To suppress date

\begin{document}

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


\begin{frame}
\frametitle{A Cyclic Model}
\framesubtitle{Not an \emph{Acyclic} model} 
\begin{center}
\includegraphics[width=2.5in]{Pinwheel}
\end{center}
\end{frame}

\begin{frame}
\frametitle{Model equations}
\framesubtitle{Assume all variances positive etc.} 
\begin{eqnarray*}
Y_1 &=& \beta_3 Y_3 + \gamma X + \epsilon_1  \\
Y_2 &=& \beta_1 Y_1 + \epsilon_2  \\
Y_3 &=& \beta_2 Y_2 + \epsilon_3
\end{eqnarray*}
In matrix terms:

\begin{displaymath}
\left(\begin{array}{c} Y_1 \\ Y_2 \\ Y_3 \end{array} \right)
    = 
\left(\begin{array}{rrr}
0 & 0 & \beta_{3} \\
\beta_{1} & 0 & 0 \\
0 & \beta_{2} & 0
\end{array}\right)
\left(\begin{array}{c} Y_1 \\ Y_2 \\ Y_3 \end{array} \right)
    +
\left(\begin{array}{c} \gamma \\ 0 \\ 0 \end{array} \right) X
    +
\left(\begin{array}{c} \epsilon_1 \\ \epsilon_2 \\ \epsilon_3 \end{array} \right)
\end{displaymath} 
\end{frame}

\begin{frame}
\frametitle{To get $V(\mathbf{Y})$}
\begin{eqnarray*}
 & & \mathbf{Y} = \boldsymbol{\beta} \mathbf{Y} + \boldsymbol{\Gamma} \mathbf{X} + \boldsymbol{\epsilon} \\
 &\Rightarrow& \mathbf{Y} - \boldsymbol{\beta} \mathbf{Y} = \boldsymbol{\Gamma} \mathbf{X} + \boldsymbol{\epsilon} \\
 &\Rightarrow& \mathbf{IY} - \boldsymbol{\beta} \mathbf{Y} = \boldsymbol{\Gamma} \mathbf{X} + \boldsymbol{\epsilon} \\
 &\Rightarrow& (\mathbf{I} - \boldsymbol{\beta} )\mathbf{Y} = \boldsymbol{\Gamma} \mathbf{X} + \boldsymbol{\epsilon}  
\end{eqnarray*} 
\vspace{5mm}
$(\mathbf{I} - \boldsymbol{\beta})^{-1}$ exists when $|\mathbf{I} - \boldsymbol{\beta}|\neq 0$

\begin{displaymath}
\mathbf{I} - \boldsymbol{\beta} = 
\left(\begin{array}{rrr}
1 & 0 & -\beta_{3} \\
-\beta_{1} & 1 & 0 \\
0 & -\beta_{2} & 1
\end{array}\right)
\end{displaymath} 
\end{frame}

\begin{frame}[fragile]
\frametitle{Calculate the determinant using Sage}
%\framesubtitle{} 
{\footnotesize % or scriptsize
\begin{verbatim}
sem = 'http://www.utstat.toronto.edu/~brunner/openSEM/sage/sem.sage' 
load(sem)
B = ZeroMatrix(3,3)
B[0,2] = var('beta3'); B[1,0] = var('beta1'); B[2,1] = var('beta2')
ImB = IdentityMatrix(3)-B
show( ImB.determinant() )
\end{verbatim} 
} % End size
\begin{displaymath}
    -\beta_{1} \beta_{2} \beta_{3} + 1
\end{displaymath}
\vspace{3mm}

So the inverse will exist unless $\beta_{1} \beta_{2} \beta_{3} = 1$.

\end{frame}


\begin{frame}
\frametitle{Solve for $Y_3$}
Starting with the model equations
\begin{eqnarray*}
Y_1 &=& \beta_3 Y_3 + \gamma X + \epsilon_1  \\
Y_2 &=& \beta_1 Y_1 + \epsilon_2  \\
Y_3 &=& \beta_2 Y_2 + \epsilon_3
\end{eqnarray*}

\vspace{3mm}

\begin{eqnarray*}
&& Y_3 = \beta_1\beta_2\beta_3Y_3 + \beta_1\beta_2\gamma X + \beta_1\beta_2\epsilon_1 + \beta_2\epsilon_2 + \epsilon_3 \\
& \Rightarrow & 
Y_3(1-\beta_1\beta_2\beta_3) = \beta_1\beta_2\gamma X + \beta_1\beta_2\epsilon_1 + \beta_2\epsilon_2 + \epsilon_3 \\
\end{eqnarray*} 

What happens if $(\mathbf{I} - \boldsymbol{\beta})^{-1}$ does not exist (and $\gamma \neq 0$)?
\end{frame}

\begin{frame}
\frametitle{If $\beta_{1} \beta_{2} \beta_{3} = 1$}
\framesubtitle{Meaning that $(\mathbf{I} - \boldsymbol{\beta})^{-1}$ does not exist} 
\begin{eqnarray*}
&& Y_3(1-\beta_1\beta_2\beta_3) = \beta_1\beta_2\gamma X + \beta_1\beta_2\epsilon_1 + \beta_2\epsilon_2 + \epsilon_3 \\ 
& \Rightarrow & 
0 = \beta_1\beta_2\gamma X + \beta_1\beta_2\epsilon_1 + \beta_2\epsilon_2 + \epsilon_3 \\
& \Rightarrow & 
E(X\cdot 0) = E\left(X (\beta_1\beta_2\gamma X + \beta_1\beta_2\epsilon_1 + \beta_2\epsilon_2 + \epsilon_3)\right) \\
& \Rightarrow & 
0 =  \beta_1\beta_2\gamma E(X^2) + 0  \\
& \Rightarrow & \beta_1\beta_2\gamma \phi = 0
\end{eqnarray*} 
with $\beta_1, \beta_2, \gamma$ and $\phi$ all non-zero.

\vspace{3mm}

So $\beta_{1} \beta_{2} \beta_{3} = 1$ contradicts the model.

\end{frame}


\begin{frame}
\frametitle{Under the assumptions of the pinwheel model}
  \begin{itemize}
    \item $(\mathbf{I} - \boldsymbol{\beta})^{-1}$ exists.
    \item $\beta_{1} \beta_{2} \beta_{3} \neq 1$.
    \item The surface $\beta_{1} \beta_{2} \beta_{3} = 1$ forms a \emph{hole} in the parameter space.
  \end{itemize}
\end{frame}

\begin{frame}
\frametitle{Covariance matrix of the factors: $\boldsymbol{\Phi}$}
\framesubtitle{Factors are $X$, $Y_1$, $Y_2$, $Y_3$} 
\begin{columns}   % Use Beamer's columns to use more of the margins!
\column{1.2\textwidth}
{\scriptsize
\begin{displaymath}
\left(\begin{array}{cccc}
\phi & -\frac{\gamma \phi}{\beta_{1} \beta_{2} \beta_{3} - 1} &
-\frac{\beta_{1} \gamma \phi}{\beta_{1} \beta_{2} \beta_{3} - 1} &
-\frac{\beta_{1} \beta_{2} \gamma \phi}{\beta_{1} \beta_{2} \beta_{3} -
1} \\
 &
\frac{\beta_{2}^{2} \beta_{3}^{2} \psi_{2} + \beta_{3}^{2} \psi_{3} +
\gamma^{2} \phi + \psi_{1}}{{\left(\beta_{1} \beta_{2} \beta_{3} -
1\right)}^{2}} & \frac{\beta_{1} \beta_{3}^{2} \psi_{3} + \beta_{1}
\gamma^{2} \phi + \beta_{2} \beta_{3} \psi_{2} + \beta_{1}
\psi_{1}}{{\left(\beta_{1} \beta_{2} \beta_{3} - 1\right)}^{2}} &
\frac{\beta_{1} \beta_{2} \gamma^{2} \phi + \beta_{2}^{2} \beta_{3}
\psi_{2} + \beta_{1} \beta_{2} \psi_{1} + \beta_{3}
\psi_{3}}{{\left(\beta_{1} \beta_{2} \beta_{3} - 1\right)}^{2}} \\
 & & \frac{\beta_{1}^{2}
\beta_{3}^{2} \psi_{3} + \beta_{1}^{2} \gamma^{2} \phi + \beta_{1}^{2}
\psi_{1} + \psi_{2}}{{\left(\beta_{1} \beta_{2} \beta_{3} -
1\right)}^{2}} & \frac{\beta_{1}^{2} \beta_{2} \gamma^{2} \phi +
\beta_{1}^{2} \beta_{2} \psi_{1} + \beta_{1} \beta_{3} \psi_{3} +
\beta_{2} \psi_{2}}{{\left(\beta_{1} \beta_{2} \beta_{3} -
1\right)}^{2}} \\
 &  &  &
\frac{\beta_{1}^{2} \beta_{2}^{2} \gamma^{2} \phi + \beta_{1}^{2}
\beta_{2}^{2} \psi_{1} + \beta_{2}^{2} \psi_{2} +
\psi_{3}}{{\left(\beta_{1} \beta_{2} \beta_{3} - 1\right)}^{2}}
\end{array}\right)
\end{displaymath} 
} % End size
\end{columns}

\vspace{5mm}

  \begin{itemize}
    \item $\phi=\phi_{11}$, $\beta_1 = \frac{\phi_{13}}{\phi_{12}}$ and $\beta_2 = \frac{\phi_{14}}{\phi_{13}}$ are easy.
    \item But then?
  \end{itemize}
\end{frame}

\begin{frame}
\frametitle{Solutions exist provided $\beta_1, \beta_2, \beta_3$ are all non-zero.}
\framesubtitle{Using Sage \ldots} 
\begin{eqnarray*}
\beta_{3} &=& \frac{\phi_{12} \phi_{13} \phi_{23} -
\phi_{13}^{2} \phi_{22}}{\phi_{12} \phi_{14} \phi_{33} -
\phi_{13} \phi_{14} \phi_{23}}  \\
&& \\
\gamma &=& \frac{\phi_{12}^{2} \phi_{33} - 2 \, \phi_{12}
\phi_{13} \phi_{23} + \phi_{13}^{2} \phi_{22}}{\phi_{11}
\phi_{12} \phi_{33} - \phi_{11} \phi_{13} \phi_{23}}  \\
&& \\
\psi_{3} &=& \frac{{\left(\phi_{13} \phi_{44} - \phi_{14}
\phi_{34}\right)} {\left(\phi_{12}^{2} \phi_{33} - 2 \,
\phi_{12} \phi_{13} \phi_{23} + \phi_{13}^{2}
\phi_{22}\right)}}{{\left(\phi_{12} \phi_{33} - \phi_{13}
\phi_{23}\right)} \phi_{12} \phi_{13}}  \\
&& \\
\psi_{2} &=& \frac{\phi_{12}^{2} \phi_{33} - 2 \,
\phi_{12} \phi_{13} \phi_{23} + \phi_{13}^{2}
\phi_{22}}{\phi_{12}^{2}} \\
&& \\
\psi_1 & = & \beta_{1}^{2} \beta_{2}^{2} \beta_{3}^{2} \phi_{22} - \beta_{2}^{2} \beta_{3}^{2} \psi_{2} - 2 \, \beta_{1} \beta_{2} \beta_{3} \phi_{22} - \beta_{3}^{2} \psi_{3} - \gamma^{2} \phi  + \phi_{22}
\end{eqnarray*} 
\end{frame}
\begin{frame}
\frametitle{Parameters of the pinwheel model are identifiable}
%\framesubtitle{} 
  \begin{itemize}
    \item Even though it does not fit any known rules
    \item And the proof is very difficult. 
  \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 Statistical Sciences, 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/431s15} {\small\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/431s15}}

\end{frame}


\end{document}

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

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

{\LARGE
\begin{displaymath}
    
\end{displaymath} }




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



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