\documentclass[color=usenames]{beamer}

\setbeamertemplate{navigation symbols}{} 
\usepackage{algorithm}
\usepackage{algorithmic}
%\usepackage{beamerthemesplit}

%\usetheme{Boadilla}
%\usecolortheme{rose}
\usepackage{multimedia}
%\logo{\includegraphics[scale=.5]{nuimc}}
\usepackage{colortbl}
\definecolor{darkblue}{rgb}{0.2,0.2,0.5}
	\definecolor{darkgreen}{rgb}{0.2,0.5,0.2}
	\definecolor{darkred}{rgb}{0.7,0.2,0.2}
	\definecolor{darkyellow}{rgb}{0.5,0.5,0.2}
	\definecolor{wheat}{rgb}{0.96,0.87,0.71}
	\definecolor{seashell}{rgb}{0.81,0.78,0.75}
\definecolor{lightblue}{rgb}{0.68,.85,.9}
\usepackage{fancybox}

\usepackage{wasysym}
\titlegraphic{\includegraphics[scale=.4]{nuimc}}
\title[Comparison sequences for visualization] {Comparison sequences for visualization: applications and algorithms }
\author[C.B. Hurley]{Catherine Hurley NUI Maynooth \\[10pt]
joint work with Wayne Oldford (Waterloo) \\[30pt]
catherine.hurley@nuim.ie 
}
\institute[NUIM]{}
\date{December 3nd 2008}
\begin{document}
\maketitle

\section{Introduction} 
\begin{frame}
\frametitle{Introduction}

\begin{itemize}
\item {\color{blue} Statistical graphics}
\begin{itemize}
 \item are about
comparisons \item comparisons between variables, cases, groups, models 
or models. \end{itemize}
\item Formalize this: 
\begin{itemize} \item build a  {\color{green} graph} whose   {\color{green}nodes} are statistical objects.
\item {\color{green}Edges}  connect objects to be compared.
\item {\color{green}Weight } edges to reflect importance of comparison
\end{itemize}
\item {\color{green} Graph traversal}  informs the construction, and the layout (in space and time)
of {\color{blue} statistical graphics}
\end{itemize}
\alert{Talk is about {\color{green}graphs} and {\color{blue}graphics}, more applications than algorithms}
\end{frame}
\begin{frame}
\frametitle{Topics}


\begin{columns}
\hspace*{.8cm}
\setbeamercolor{wheatbg}{fg=black,bg=wheat} 
\begin{column}{.4\textwidth}
\begin{beamercolorbox}[wd=1.6in,rounded=true]{wheatbg} 
Parallel coordinate plots \\
Table plots\\
Interaction plots\\
Model comparison\\
Dynamic Scatterplots \\
Cable plots
\end{beamercolorbox} \end{column} 
\begin{column}{.12\textwidth}
{\LARGE {\bf $\longleftrightarrow$}}
\end{column}
\setbeamercolor{seashellbg}{fg=black,bg=seashell} 
\begin{column}{.58\textwidth}
\begin{beamercolorbox}[wd=1.8in,rounded=true]{seashellbg} 
Graphs \\
Complete Graphs\\
Hamiltonians and Eulerians\\
Bipartite Graphs\\
Hypercube graphs \\
 Product Graphs\\
 Line graphs \\
 3d and 4d transition graphs  
\end{beamercolorbox} 
\end{column}
\end{columns}


\setbeamercolor{bluebg}{fg=black,bg=lightblue} 
\vspace*{.4in} \hspace*{1.6in}
\begin{beamercolorbox}[wd=0.5in,rounded=true]{bluebg} 
PairViz \end{beamercolorbox} 

\end{frame}

\section{Introductory examples}
\subsection{Comparing Raters}

\begin{frame}
\frametitle{Comparing Raters}

\begin{columns}
 \begin{column}{0.5\textwidth}
 \includegraphics[scale=.84]{fig/rating1}
   
\end{column}


 \begin{column}{0.5\textwidth}

 \begin{itemize}
\item {\small \color{blue} Diagnoses data (Fleiss) contains psychiatric diagnoses of 30 patients provided by 6 raters. }
\item {\small \color{blue}  Depression (1), Personality disorder (2), Schizophrenia (3), Neurosis (4), O= Other (5).}

\item  Barchart: proportion agreement
 \end{itemize}
\end{column}
\end{columns}


\end{frame}

\begin{frame}
\frametitle{Comparing Raters}
\framesubtitle{Improved display:}


\begin{columns}
 \begin{column}{0.5\textwidth}
  \includegraphics[scale=.84]{fig/rating2}
\end{column}

 \begin{column}{0.5\textwidth}
 \begin{itemize}
\item Spread out values
\item fatten axes, 
\item and add boxes \vspace*{.5cm}
\item {\color{darkgreen} Can compare marginal distributions and}
\item {\color{darkgreen} Can follow patients}
 \end{itemize}
\end{column}
\end{columns}


\end{frame}


\begin{frame}
\frametitle{Comparing All Raters}


\includegraphics[scale=.64]{fig/rating3}

 \begin{itemize}
\item All pairs of raters appear adjacently at least once, and
\item the pairs are ordered in such a way that the raters whose agreement is higher tend to appear first. \item Good agreement between raters 3, 4 and 5. 
\item Rater 6 has low agreement with all other raters, but especially with rater 1.
\end{itemize}
\end{frame}


\subsection{Table plots}

\begin{frame}
\frametitle{Comparing barcharts}

\begin{columns}
 \begin{column}{0.5\textwidth}
 \includegraphics[scale=.64]{fig/euro1}
   
\end{column}


 \begin{column}{0.5\textwidth}

 \begin{itemize}
\item {\small \color{blue} UK survey: which of 13 characteristics they would associate with nationals of other European countries. }
\item {\small \color{blue} Data are
 percents of respondants. (Der and Everitt.)}
\item  Table plot, with both countries and characteristics sorted.
\item Ireland's ratings are quite similar to those of the UK, less so to its other neighbour Spain

 \end{itemize}
\end{column}
\end{columns}

\end{frame}

\begin{frame}
\frametitle{Comparing barcharts}
% again
\begin{columns}
 \begin{column}{0.5\textwidth}
 \includegraphics[scale=.64]{fig/euro2}
   
\end{column}


 \begin{column}{0.5\textwidth}

 \begin{itemize}
\item The second version shows a different ordering of countries.
\item Dissimilar countries are adjacent, facilitates different comparisons
\item Need 4 orderings to see all countries adjacently.

 \end{itemize}
\end{column}
\end{columns}

\end{frame}

\section{Graphs}

\begin{frame}
\frametitle{Graphs: nodes, edges and weights}
 \begin{itemize}
 \item
$n$ variables, cases, factor levels, boxplots: identify with {\color{green}nodes}  of graph
\item visualisation: requires  {\color{green}graph traversal}
 \item
All possible pairings are of interest: place an  {\color{green}undirected edge}  between each pair of nodes
 \item
Graph is complete, $K_n$ 

 \includegraphics[scale=.3]{fig/K_7}

 \item
Dissimilarity measure: {\color{green}edge weight}
\end{itemize}

\end{frame}

\subsection{Hamiltonian and Eulerian paths}

\begin{frame}
\frametitle{Hamiltonian and Eulerian paths}
 
 \begin{columns}
 \begin{column}{0.5\textwidth}
\begin{itemize}
 \item[] {\color{red} Hamiltonian path} gives a permutation of vertices \end{itemize}
 \includegraphics[scale=.25]{fig/k7-sym-h11} 
 \end{column}
 
 \begin{column}{0.5\textwidth}
\begin{itemize}
   \item[] {\color{red} Eulerian path} visits all edges  \end{itemize}
    \includegraphics[scale=.25]{fig/K_7}
 \end{column} \end{columns}   
 
 \begin{itemize}
   \item[] {\color{red} Hamiltonian decomposition}: an eulerian tour composed of
 edge-distinct hamiltonian cycles \end{itemize}
   \includegraphics[scale=.25]{fig/k7-sym-h11}
\includegraphics[scale=.25]{fig/k7-sym-h12}
\includegraphics[scale=.25]{fig/k7-sym-h13}


\end{frame}

\section{Complete graph examples}
\begin{frame}
\frametitle{Revisit: Comparing All Raters}


\includegraphics[scale=.64]{fig/rating31}

 \begin{itemize}
\item Graph $K_6$ is not eulerian, because all nodes are odd.
\item $K_6^e$, augmented version of $K_6$ which is eulerian.
 \item Duplicate edges 1-3, 2-4 and 5-6 (omitted).
 \item Modification of classical algorithm for weight-decreasing eulerians (etour in PairViz).
\end{itemize}
\end{frame}


\begin{frame}
\frametitle{Revisit: Comparing barcharts}

\begin{columns}
 \begin{column}{0.5\textwidth}
 \includegraphics[scale=.64]{fig/euro1}
   
\end{column}


 \begin{column}{0.5\textwidth}

 \begin{itemize}
\item Country ordering is a hamiltonian path on $K_7$.
\item Graph is eulerian and also decomposes into 3 hamiltonian cycles
\item  Here we show hamiltonian paths. 
\item Require 4 hamiltonian paths to visit all edges, which is not a decomposition.
\item weighted\_hpaths in PairViz
 \end{itemize}
\end{column}
\end{columns}

\end{frame}
\section{Bipartite graphs}
\begin{frame}
\frametitle{Bipartite graphs}
Suppose two are expert raters and we wish to compare others to them:
\includegraphics[scale=.64]{fig/rating4}
\includegraphics[scale=.44]{fig/bipartite}
\begin{itemize}
\item Graph is eulerian: Use {\color{blue} {\color{red}{1}}3{\color{red}{2}}4{\color{red}{1}}5{\color{red}{2}}6{\color{red}{1}}}.
\item Graph $K_{m,n}$ is eulerian if m and n are both even.
\item Other applications: m responses, n predictors, where only response-predictor relationships are
of interest.
\end{itemize}
\end{frame}


\section{Model selection}

\subsection{Hypercube graph}
\begin{frame}
\frametitle{Model comparison and hypercube graph}
Model selection with $n$ predictors
\begin{columns}
 \begin{column}{0.5\textwidth}
\begin{itemize}
 \item Hypercube graph represents possible moves in a stepwise regression algorithm
 \item  Example with $n$ = 4 
 \item Graph $Q_n$ is hamiltonian, and eulerian for even $n$
 \end{itemize}
\end{column}
 
 \begin{column}{0.5\textwidth}
 \includegraphics[scale=.64]{fig/hypercube1}  
   
   \end{column} \end{columns}   

\end{frame}

\begin{frame}
\frametitle{Sleep data}

\begin{itemize}
\item {\small \color{blue}Y= log brain wt.  Predictors A= non dreaming sleep, B=dreaming sleep, C=log body wt, D=life span}
\item Eulerian starting at full model.  Bars show change in SSE.
\item All models with C give good results
\end{itemize}
 \includegraphics[scale=.54]{fig/sleep1}  
\end{frame}

\begin{frame}
\frametitle{Reduce model space}
\begin{columns}
 \begin{column}{0.5\textwidth}
\begin{itemize}
\item Drop intercept
\item Or, show only models with C
\item Graph $Q_3$ is not eulerian: all nodes are odd
\end{itemize}
\end{column}
 \begin{column}{0.5\textwidth}
 \includegraphics[scale=.34]{fig/hypercube2}  
 \end{column}
 \end{columns}
 
 \begin{columns}
  \hspace*{-1cm}
 \begin{column}{0.8\textwidth}
  \includegraphics[scale=.54]{fig/sleep2}  \\
 Open eulerian path from ABCD to C
 \end{column}
 
 \hspace*{-3cm}
  \begin{column}{0.2\textwidth}
 Add edges: ACD-AC,  ABC-BCD, BC-CD (grey)
 \end{column}
 \end{columns}
\end{frame}


\section{Interaction plots}

\subsection{Graph products}


\begin{frame}
\frametitle{Interaction plots}
{\color{blue} Data: survival time of 48 rats, each given
one of four treatments A, B, C, or D and one of three poisons P1, P2, or P3 
 (Box and Cox)}
 
 \begin{columns}
\begin{column}{0.5\textwidth}
    \includegraphics[scale=.44]{fig/inter1}  \end{column}
\begin{column}{0.5\textwidth}
   \includegraphics[scale=.44]{fig/inter2}  
\end{column}
\end{columns}
Check for parallelism of profiles
\end{frame}


\begin{frame}
\frametitle{Graphs}


 \begin{columns}
 \begin{column}{0.2\textwidth}
Main effects:
 \end{column}
\begin{column}{0.4\textwidth}
    \includegraphics[scale=.34]{fig/kpoi}  \\
    Poisons: $K_3$
    \end{column}
\begin{column}{0.4\textwidth}
   \includegraphics[scale=.34]{fig/ktreat}  \\
    Treatments: $K_4$
\end{column}
\end{columns}
\vspace*{1cm}
\begin{columns}
 \begin{column}{0.2\textwidth}
Interactions:
 \end{column}
  \begin{column}{0.5\textwidth}

  \includegraphics[scale=.34]{fig/cart1} \\
  Cartesian product graph 
 $K_3 \times K_4$
  \end{column}
   \begin{column}{0.3\textwidth} \mbox{} \end{column}
\end{columns}

\end{frame}

\begin{frame}
\frametitle{Revised interaction plots}
 
 \begin{columns}
\begin{column}{0.5\textwidth}
    \includegraphics[scale=.44]{fig/inter3}
         \end{column}
\begin{column}{0.5\textwidth}
  Double crossing in first set of profiles gives stronger impression of interaction.\\
    Second set of profiles: long line segments connecting treatments B and A 
    gives impression of parallelism
\end{column}
\end{columns}

 \begin{columns}
\begin{column}{0.5\textwidth}
    \includegraphics[scale=.44]{fig/inter4}     \end{column}
\begin{column}{0.5\textwidth}
 Survival times for P3 are low, regardless of treatment    
\end{column}
\end{columns}
Alternatively: reduce tilt by subtracting average profile, for easier vertical comparisons.
\end{frame}

\section{Scatterplots}

\subsection{Line graphs}

\begin{frame}
\frametitle{Scatterplot transitions}
\framesubtitle{Example $p=4$, Iris data}
\begin{columns}
\begin{column}[t]{0.25\textwidth}
\includegraphics[scale=.3]{fig/iris_vars} \\
{\small  \begin{center}  $K_4$  Complete graph \end{center}}
\end{column}

\begin{column}[t]{0.4\textwidth}
\includegraphics[scale=.3]{fig/iris_3d_path_graph} \\
{\small \begin{center}   $L(K_4)$ 3d transitions graph \\
Eulerian graph,
Hamiltonian decomposition \end{center}}
\end{column}

\begin{column}[t]{0.4\textwidth}
\includegraphics[scale=.3]{fig/iris_4d_graph} \\
{\small \begin{center}   $\overline{L(K_4)}$ 4d transitions graph \end{center}}
\end{column}
\end{columns}


\end{frame}

\begin{frame}
\frametitle{Visualizing scatterplot transitions}
\framesubtitle{Example $p=4$, Iris data}
\begin{columns}

\begin{column}{0.4\textwidth}
\includegraphics[scale=.3]{fig/iris_3d_path_graph} \\
{\tiny \begin{center}   $L(K_4)$ 3d transitions graph \\
Eulerian graph,
Hamiltonian decomposition \end{center}}
\end{column}

\begin{column}{0.6\textwidth}
\includegraphics<1>[width=4cm,height=4cm]{irism0}
\movie[autostart,palindrome]{\includegraphics<2>[width=4cm,height=4cm]{irism0} }{iris11.mov}\\
{\small The yellow route}

\end{column}
\end{columns}
\vspace*{1cm}
Choice of edge weights.... scagnostics?



\end{frame}

%\begin{frame}
%\frametitle{Visualizing scatterplot transitions}
%%\movie[showcontrols,palindrome,autostart]{\includegraphics[width=4cm,height=4cm]{irismov1} }{irismov.avi}\\
%\includegraphics<1>[width=4cm,height=4cm]{irism0}
%\movie[autostart]{\includegraphics<2>[width=4cm,height=4cm]{irism0} }{iris11.mov}\\
%{\tiny The yellow route}
%%\DeclareGraphicsRule{*}{pdf}{*}{}
%%%\multiinclude[<+>][format="jpeg"]{iris3dscat/irism}
%%\animate<2-9>
%%\multiinclude[<+>][graphics={scale=.3},end=10]{iris3dscat/irism}

%%%\animategraphics{12}{iris3dscat/irism.}{0}{9}
%\end{frame}

\section{Cable plot} 
\begin{frame}
\frametitle{Another example}
\framesubtitle{Five variables of sleep data}
\begin{columns}
\begin{column}[c]{0.3\textwidth}
\includegraphics[scale=.148]{fig/petersen} \\
{\tiny 4d transition graph for p=5}
\end{column}
\begin{column}[c]{0.7\textwidth}
\includegraphics<1>[scale=.18]{sleepm0}
\movie[autostart,palindrome]{\includegraphics<2>[scale=.18]{sleepm0} }{sleepmovie4.mov}\\
{\small \begin{itemize}
\item  Static display is hamiltonian cycle on variables
\item Movie visits outer cycle of the transition graph and
\item transitions to another hamiltonian cycle on the variables
\end{itemize}}
\end{column}
\end{columns}
\vspace*{1cm}
{\color{red} {\it Graphs provide a map for navigating through high dimensional space}}
%\DeclareGraphicsRule{*}{pdf}{*}{}
%%\multiinclude[<+>][format="jpeg"]{iris3dscat/irism}
%\animate<2-9>
%\multiinclude[<+>][graphics={scale=.3},end=10]{iris3dscat/irism}

%%\animategraphics{12}{iris3dscat/irism.}{0}{9}
\end{frame}



\begin{frame}
\frametitle{PairViz}
\framesubtitle{What's available}
{\small
\begin{columns}
\hspace*{.8cm}
\setbeamercolor{wheatbg}{fg=black,bg=wheat} 
\begin{column}{.4\textwidth}
\begin{beamercolorbox}[wd=1.6in,rounded=true]{wheatbg} 
Parallel coordinate plots \\
Table plots\\
Interaction plots\\
Model comparison\\
-----------------------------
Dynamic Scatterplots \\
Cable plots
\end{beamercolorbox} \end{column} 
\begin{column}{.12\textwidth}
{\LARGE {\bf $\longleftrightarrow$}}
\end{column}
\setbeamercolor{seashellbg}{fg=black,bg=seashell} 
\begin{column}{.58\textwidth}
\begin{beamercolorbox}[wd=1.8in,rounded=true]{seashellbg} 
Graphs \\
Complete Graphs\\
Hamiltonians and Eulerians\\
------------------------\\
Bipartite Graphs\\
Hypercube graphs \\
 Product Graphs\\
 Line graphs \\
 3d and 4d transition graphs  
\end{beamercolorbox} 
\end{column}
\end{columns}




{\color{purple}
Graph traversals:
\begin{itemize}
\item eseq - eulerians on complete graphs 
\item hpaths- hamiltonian decompositions on complete graphs  \\
\hspace*{1cm} also with weights
\item eulerian- eulerians on connected graph, using weights
\end{itemize}

Graphics:
\begin{itemize} 
\item guided\_pcp, table\_plot,  mc\_plot (for multiple comparisons)
\end{itemize}}
}
\end{frame}


%\begin{frame}
%\frametitle{References}
%\begin{itemize} 
%\item Pairwise display of high dimensional information via\\ Eulerian tours and Hamiltonian decompositions
%\item Eulerian tour algorithms for data visualization and the \texttt{PairViz} package
%\item Graphs as navigational infrastructure 
%for high dimensional data spaces 

%\end{itemize}
%\end{frame}
\section{Conclusions} 
\begin{frame}
\frametitle{Conclusions: Graphs and Graphics}
\begin{itemize}
 \item[ $\RHD$] A graph structure underlies many statistical graphics  
 \item[ $\RHD$] Leads to improved understanding, improved graphics 
 \item[ $\RHD$]A roadmap for exploring high-dimensional spaces 
 \item[ $\RHD$]  and perhaps even a GUI.
\end{itemize}
\end{frame}

\end{document}