\documentclass[ignorenonframetext,aspectratio=169]{beamer}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\newif\ifbibliography
\hypersetup{
            pdftitle={Unit 1: Exploring Data},
            pdfauthor={Statistics 102 Teaching Team},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\usepackage{longtable,booktabs}
\usepackage{caption}
% These lines are needed to make table captions work with longtable:
\makeatletter
\def\fnum@table{\tablename~\thetable}
\makeatother
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight0.8\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}

% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom

\AtBeginPart{
  \let\insertpartnumber\relax
  \let\partname\relax
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \let\insertsectionnumber\relax
    \let\sectionname\relax
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \let\insertsubsectionnumber\relax
  \let\subsectionname\relax
  \frame{\subsectionpage}
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
\usepackage{amsmath,verbatim}

\usepackage{multirow}
\usepackage{fancyvrb}
\usepackage{manfnt}
\usepackage[normalem]{ulem}

\usepackage{hyperref}
\hypersetup{
	colorlinks,
	linkcolor={blue!50!black},
	urlcolor={blue!80!black}
}

%\usepackage[colorlinks=true]{hyperref}

\mode<presentation>{\usetheme{Malmoe}}

%\synctex=1

\setbeamertemplate{headline}{}


\setbeamerfont{footline}{size=\scriptsize}
\setbeamerfont{frametitle}{shape=\scshape}
\setbeamertemplate{itemize items}[circle]
\setbeamercovered{transparent}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]{} 


\definecolor{forest}{rgb}{0, .5, 0}
\definecolor{brick}{rgb}{.5, 0, 0}
\definecolor{darkgreen}{rgb}{0, .5, 0}
\definecolor{darkred}{rgb}{.7, .15, .15}
\definecolor{darkblue}{rgb}{0, 0, .5}
\definecolor{Green}{rgb}{0.2,1,0.2}


\newcommand{\R}{\textsf{R}}
\newcommand{\RStudio}{\textsl{R Studio}}


\usepackage[english]{babel}
%\usepackage{palatino}
\usepackage[T1]{fontenc}


% make all tt fonts bold to look more like Verbatim
\usepackage{lmodern}
\renewcommand\ttfamily{\usefont{T1}{lmtt}{m}{n}}

% Comment these out if you don't want a slide with just the
% part/section/subsection/subsubsection title:
\AtBeginPart{
  \let\insertpartnumber\relax
  \let\partname\relax
  \frame{\partpage}
}
\AtBeginSection{
  \let\insertsectionnumber\relax
  \let\sectionname\relax
  \frame{\sectionpage}
}
\AtBeginSubsection{
  \let\insertsubsectionnumber\relax
  \let\subsectionname\relax
  \frame{\subsectionpage}
}

\newenvironment{twocol}[4]{
\begin{columns}[c]
\column{#1\textwidth}
#3
\column{#2\textwidth}
#4
\end{columns}
}

\def\begincols{\begin{columns}}
\def\begincol{\begin{column}}
\def\endcol{\end{column}}
\def\endcols{\end{columns}}

\title{Unit 1: Exploring Data}
\author{Statistics 102 Teaching Team}
\date{January 27, 2020}

\begin{document}
\frame{\titlepage}

\begin{frame}
\tableofcontents[hideallsubsections]
\end{frame}

\section{Data basics}\label{data-basics}

\begin{frame}{Example: the \emph{FAMuSS} study}

\emph{The Functional SNPs Associated with Muscle Size and Strength}
(FAMuSS) study and data is introduced in \emph{OI Biostat}, Section
1.2.2.

One goal of the study---examine the association of demographic,
physiological and genetic characteristics with muscle strength.

\begin{itemize}
\tightlist
\item
  In simpler terms, study the ``sports gene'' \emph{ACTN3}.
\end{itemize}

\end{frame}

\begin{frame}{Four rows from \emph{FAMuSS} data matrix}

\captionsetup[table]{labelformat=empty}

\begin{longtable}[]{@{}lrlrrlr@{}}
\caption{\emph{OI Biostat} Table 1.6}\tabularnewline
\toprule
sex & age & race & height & weight & actn3.r577x &
ndrm.ch\tabularnewline
\midrule
\endfirsthead
\toprule
sex & age & race & height & weight & actn3.r577x &
ndrm.ch\tabularnewline
\midrule
\endhead
Female & 27 & Caucasian & 65.0 & 199 & CC & 40.0\tabularnewline
Male & 36 & Caucasian & 71.7 & 189 & CT & 25.0\tabularnewline
Female & 24 & Caucasian & 65.0 & 134 & CT & 40.0\tabularnewline
Female & 30 & Caucasian & 64.0 & 134 & CC & 43.8\tabularnewline
\bottomrule
\end{longtable}

\end{frame}

\begin{frame}{\emph{FAMuSS} Variables and their descriptions}

\begin{center}
    \begin{tabular}{ll}
        {\bf Variable} & {\bf Description} \\
        & \\
        \texttt{sex} & Sex of the participant \\
        \texttt{age} & Age in years   \\
        \texttt{race} & Recorded as African Am (African American),\\
           & Caucasian, Asian, Hispanic, Other \\
        \texttt{height} & Height in inches    \\
        \texttt{weight} & Weight in pounds  \\
        \texttt{actn3.r577x} & Genotype at the location r577x in the ACTN3 gene. \\
        \texttt{ndrm.ch} & Percent change in strength in the non-dominant arm, \\
          & comparing strength after to before training \\
    \end{tabular}
\end{center}

\end{frame}

\begin{frame}{Types of Variables}

\textbf{Numerical variables} take on numerical values, such that
numerical operations (sums, differences, etc.) are reasonable.

\begin{itemize}
\item
  Discrete: only take on integer values (e.g., \# of family members)
\item
  Continuous: can take on any value within a specified range (e.g.,
  height)
\end{itemize}

\textbf{Categorical variables} take on values that are names or labels;
the possible values are called the variable's \emph{levels}.

\begin{itemize}
\tightlist
\item
  Ordinal: exists some natural ordering of levels (e.g., education)
\item
  Nominal: no natural ordering of levels (e.g., gender)
\end{itemize}

\end{frame}

\begin{frame}{Types of variables}

\includegraphics{figures/variableTypes.png}

\end{frame}

\begin{frame}{Exploring data with simple tools}

Techniques for exploring and summarizing data differ for numerical
versus categorical variables.

Numerical and graphical summaries are useful for examining variables one
at a time, but also for exploring the relationships between variables.

\end{frame}

\section{Numerical data}\label{numerical-data}

\begin{frame}{Distributions and summary measures}

The collection of values for a numerical, continuous variable (e.g.,
\texttt{weight}) is the \emph{distribution} for that variable.

Numerical and graphical summaries convey characteristics of a
distribution without listing all the values.

Important characteristics include\ldots{}

\begin{itemize}
\tightlist
\item
  Center: where is the middle of the distribution?

  \begin{itemize}
  \tightlist
  \item
    Measures of center: mean, median
  \end{itemize}
\item
  Spread: how similar or varied are the values to each other?

  \begin{itemize}
  \tightlist
  \item
    Measures of spread: standard deviation, interquartile range
  \end{itemize}
\end{itemize}

\end{frame}

\begin{frame}[fragile]{Measures of center}

The \emph{sample mean} of a variable is the sum of all observations
divided by the number of observations:

\[\overline{x} = \frac{x_1+x_2+\cdots+x_n}{n}\]\\
where \(x_1, x_2, \ldots, x_n\) represent the \(n\) observed values in a
sample.

The mean weight in \texttt{famuss} is 155.65 pounds:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{mean}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## [1] 155.6479
\end{verbatim}

\end{frame}

\begin{frame}[fragile]{Measures of center \ldots{}}

The \emph{median} is the value of the middle observation in a sample.

If the number of observations is

\begin{itemize}
\tightlist
\item
  Odd, the median is the middle observation
\item
  Even, the median is the average of the two middle observations
\end{itemize}

The median is the \(50^{th}\) percentile; 50\% of observations lie
below/above the median.

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{median}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## [1] 150
\end{verbatim}

\end{frame}

\begin{frame}{Measures of spread}

The \emph{standard deviation} measures (approximately) the distance
between a typical observation and the mean.

\begin{itemize}
\item
  An observation's \emph{deviation} is the distance between its value
  \(x\) and the sample mean \(\overline{x}\): \(x - \overline{x}\).
\item
  The \emph{sample variance} \(s^2\) is the sum of squared deviations
  divided by the number of observations minus 1.
  \[s^2 = \frac{({x_1 - \overline{x})}^{2}+({x_2 - \overline{x})}^{2}+\cdots+({x_n - \overline{x})}^{2}}{n-1}, \]
  where \(x_1, x_2, \dots, x_n\) represent the \(n\) observed values.
\item
  The \emph{standard deviation} \(s\) is the square root of the
  variance.
  \[s = \sqrt{\frac{({x_1 - \overline{x})}^{2}+({x_2 - \overline{x})}^{2}+\cdots+({x_n - \overline{x})}^{2}}{n-1}}\]
\end{itemize}

\end{frame}

\begin{frame}[fragile]{Measures of Spread: Percentiles/Quartiles}

The \(p^{th}\) percentile is the observation such that \(p\%\) of the
remaining observations fall below this observation.

\begin{itemize}
\tightlist
\item
  The \emph{first quartile (\(Q_1\))} is the \(25^{th}\) percentile.
\item
  The \emph{second quartile (\(Q_2\))}, i.e., the median, is the
  \(50^{th}\) percentile.
\item
  The \emph{third quartile (\(Q_3\))} is the \(75^{th}\) percentile.
\end{itemize}

The \emph{interquartile range (IQR)} is the distance between the third
and first quartiles. \[IQR = Q_3 - Q_1 \]

\footnotesize

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{sd}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## [1] 34.58999
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{IQR}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## [1] 42
\end{verbatim}

\end{frame}

\begin{frame}{Robust estimates}

The median and IQR are called \emph{robust estimates} because they are
less likely to be affected by extreme values than the mean and standard
deviation.

For distributions containing extreme observations, the median and IQR
provide a more accurate sense of center and spread.

\end{frame}

\begin{frame}[fragile]{Histograms}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{hist}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}

\includegraphics{unit_01_data_files/figure-beamer/hist_weight-1.pdf}

\end{frame}

\begin{frame}{Histograms \dots}

Histograms show important features of the shape of a distribution:

\begin{itemize}
\item
  Symmetry, or lack of it (skew)
\item
  Minimum and maximum values
\item
  Regions of high frequency (modes)
\end{itemize}

Histograms not so good for:

\begin{itemize}
\item
  Displaying median, quartiles
\item
  Showing subtle skewing
\item
  Identifying extreme values
\end{itemize}

\end{frame}

\begin{frame}{\emph{OI Biostat}, Figure 1.20, frog data}

\includegraphics{figures/frogBoxPlot.pdf}

\end{frame}

\begin{frame}{Boxplots}

A boxplot indicates the positions of the first, second, and third
quartiles of a distribution in addition to potential \textbf{outliers},
observations that are far from the center of a distribution.

\begin{itemize}
\item
  Large outliers: values \textgreater{} \(Q_3 + (1.5\times IQR)\)
\item
  Small outliers: values \textless{} \(Q_1 - (1.5 \times IQR)\)
\end{itemize}

On a boxplot\ldots{}

\begin{itemize}
\item
  The rectangle extends from the first quartile to the third quartile,
  with a line at the second quartile (median).
\item
  Whiskers capture data between \(Q_1 - (1.5 \times IQR)\) and
  \(Q_3 + (1.5\times IQR)\) ; whiskers must end at data points.
\item
  Potential outliers shown with dots.
\end{itemize}

\end{frame}

\section{Categorical data}\label{categorical-data}

\begin{frame}[fragile]{Tables}

A table for a single variable, a \emph{frequency table} or \emph{one-way
table}, summarizes the distribution of observations among categories.

Based on the table, describe the distribution of genotype at the
location \emph{actn3.r577x} among the study participants.

\small

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{table}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{actn3.r577x)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## 
##  CC  CT  TT 
## 173 261 161
\end{verbatim}

\end{frame}

\begin{frame}[fragile]{Bar plots for categorical data}

A bar plot is a common way to display a single categorical variable.

\small

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{barplot}\NormalTok{(}\KeywordTok{table}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{actn3.r577x))}
\end{Highlighting}
\end{Shaded}

\includegraphics{unit_01_data_files/figure-beamer/unnamed-chunk-6-1.pdf}

\end{frame}

\section{Relationships between two
variables}\label{relationships-between-two-variables}

\begin{frame}{Summarizing relationships between two variables}

Approaches for summarizing relationships between two variables vary
depending on variable types\ldots{}

\begin{itemize}
\item
  Two numerical variables
\item
  Two categorical variables
\item
  One numerical variable and one categorical variable
\end{itemize}

\end{frame}

\begin{frame}{Two numerical variables}

Two variables \(x\) and \(y\) are

\begin{itemize}
\item
  \emph{positively associated} if \(y\) increases as \(x\) increases.
\item
  \emph{negatively associated} if \(y\) decreases as \(x\) increases.
\end{itemize}

Height and weight are positively associated.

\end{frame}

\begin{frame}[fragile]{Two numerical variables \dots}

\small

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{plot}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{height, famuss}\OperatorTok{$}\NormalTok{weight,}
     \DataTypeTok{xlab =} \StringTok{"Height (in)"}\NormalTok{, }\DataTypeTok{ylab =} \StringTok{"Weight (lb)"}\NormalTok{, }\DataTypeTok{cex =} \FloatTok{0.8}\NormalTok{)  }
\end{Highlighting}
\end{Shaded}

\includegraphics{unit_01_data_files/figure-beamer/scatter_height_weight-1.pdf}

\end{frame}

\begin{frame}[fragile]{Two numerical variables \dots}

Correlation is a numerical summary that measures the strength of a
linear relationship between two variables.

\begin{itemize}
\item
  Introduced in \emph{OI Biostat} Section 1.6.1; details in Ch. 6.
\item
  The correlation coefficient \(r\) takes on values between -1 and 1.
\item
  The closer \(r\) is to \(\pm 1\), the stronger the linear association.
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{cor}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{height, famuss}\OperatorTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## [1] 0.5308787
\end{verbatim}

\end{frame}

\begin{frame}[fragile]{Two categorical variables}

A contingency table summarizes data for two categorical variables.

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{addmargins}\NormalTok{(}\KeywordTok{table}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{race, famuss}\OperatorTok{$}\NormalTok{actn3.r577x))}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
##             
##               CC  CT  TT Sum
##   African Am  16   6   5  27
##   Asian       21  18  16  55
##   Caucasian  125 216 126 467
##   Hispanic     4  10   9  23
##   Other        7  11   5  23
##   Sum        173 261 161 595
\end{verbatim}

\end{frame}

\begin{frame}[fragile]{Two categorical variables \dots}

\scriptsize

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#row proportions}
\KeywordTok{addmargins}\NormalTok{(}\KeywordTok{prop.table}\NormalTok{(}\KeywordTok{table}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{race, famuss}\OperatorTok{$}\NormalTok{actn3.r577x), }\DecValTok{1}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
##             
##                     CC        CT        TT       Sum
##   African Am 0.5925926 0.2222222 0.1851852 1.0000000
##   Asian      0.3818182 0.3272727 0.2909091 1.0000000
##   Caucasian  0.2676660 0.4625268 0.2698073 1.0000000
##   Hispanic   0.1739130 0.4347826 0.3913043 1.0000000
##   Other      0.3043478 0.4782609 0.2173913 1.0000000
##   Sum        1.7203376 1.9250652 1.3545972 5.0000000
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#column proportions}
\KeywordTok{addmargins}\NormalTok{(}\KeywordTok{prop.table}\NormalTok{(}\KeywordTok{table}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{race, famuss}\OperatorTok{$}\NormalTok{actn3.r577x), }\DecValTok{2}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
##             
##                      CC         CT         TT        Sum
##   African Am 0.09248555 0.02298851 0.03105590 0.14652996
##   Asian      0.12138728 0.06896552 0.09937888 0.28973168
##   Caucasian  0.72254335 0.82758621 0.78260870 2.33273826
##   Hispanic   0.02312139 0.03831418 0.05590062 0.11733618
##   Other      0.04046243 0.04214559 0.03105590 0.11366392
##   Sum        1.00000000 1.00000000 1.00000000 3.00000000
\end{verbatim}

\end{frame}

\begin{frame}{Two categorical variables \dots}

\includegraphics{figures/famussSegBarA.pdf}

\emph{OI Biostat} Figure 1.35a, segmented bar plot

\end{frame}

\begin{frame}{Two categorical variables \dots}

\includegraphics{figures/famussSegBarStaA.pdf}

\emph{OI Biostat} Figure 1.35b, standardized segmented bar plot

\end{frame}

\begin{frame}{Two categorical variables \dots}

\emph{Relative risk} (RR) is one way of summarizing data presented in a
two-way table of study outcome by participant group.

More in Lab 1 \dots

\end{frame}

\begin{frame}{A numerical variable and a categorical variable}

\emph{FAMuSS} was designed to study the relationship between genotype at
the location \emph{r577x} in the gene \emph{ACTN3} and muscle strength.

Muscle strength was assessed by the percent change in non-dominant arm
strength after resistance training (\texttt{ndrm.ch}).

What visualization would be a good choice to make this comparison?

\end{frame}

\begin{frame}[fragile]{A numerical variable and a categorical variable
\dots}

\scriptsize

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{boxplot}\NormalTok{(famuss}\OperatorTok{$}\NormalTok{ndrm.ch }\OperatorTok{~}\StringTok{ }\NormalTok{famuss}\OperatorTok{$}\NormalTok{actn3.r577x)}
\end{Highlighting}
\end{Shaded}

\includegraphics{unit_01_data_files/figure-beamer/ndrmbox-1.pdf}

\end{frame}

\section{Case study: molecular cancer
classification}\label{case-study-molecular-cancer-classification}

\begin{frame}{The potential value of genomic data in cancer}

The majority of cancers are diagnosed by an expert pathologist examining
slides of malignant cells.

Can that be done more accurately by characterizing the genetic makeup of
the malignancy?

\begin{itemize}
\tightlist
\item
  This is perhaps the major potential of genomic characterizations of
  tumors.
\end{itemize}

There are many forms of childhood leukemia.

\begin{itemize}
\item
  Acute myeloblastic leukemia (AML) and acute lymphoblastic leukemia
  (ALL) are the most common.
\item
  AML is a cancer of the bone marrow, where white blood cells
  (lymphocytes) are produced.
\item
  ALL is a cancer of the lymphocytes and is designated as B-cell (ALLB)
  or T-cell (ALLT).
\end{itemize}

\end{frame}

\begin{frame}{Prognosis of the two cancers}

The probability that a child diagnosed with ALL is survives at least 5
years after the diagnosis is approximately 90\%.

Approximately 65\% of children diagnosed with AML survive at least 5
years.

The diagnosis of leukemia type determines the therapy that will be given
to the child, and the successful treatments for ALL and AML are
different.

In 1999, Todd Golub from the Dana-Farber and the Broad Institute
examined the possibility of classifying leukemia through using a genetic
analysis of a blood sample.

\end{frame}

\begin{frame}{Analyzing the Golub data}

We can re-analyze the Golub data using tools from graphical and
numerical summaries.

Our analysis will not be identical to the Golub analysis, but will be
similar in spirit.

The tools are straighforward\ldots   

\begin{itemize}
\item
  Thinking through the problem and assembling the tools is the hard
  part.
\item
  The process is more important than the final recipe.
\end{itemize}

\end{frame}

\begin{frame}{Gene expression (details in \emph{OI Biostat})}

\small

\begin{itemize}
\item
  The genetic code stored in DNA contains the information for producing
  the proteins that determine an organism's phenotype.
\item
  Genes that are transcriptionally active (i.e.~turned ``on'') are
  transcribed into messenger RNA (mRNA) that gets translated into
  proteins.
\item
  Genes can be switched on or off, and expressed at varying levels.
  Variations in gene expression produce the range of physical,
  biochemical, and developmental differences in cells and tissues.
\item
  Quantifying the amount of RNA produced in a cell allows for a measure
  of gene expression.
\item
  The transcriptome, or expression profile, is the complete set of RNA
  transcripts produced by the genome in a cell or set of cells.
\end{itemize}

\end{frame}

\begin{frame}{Microarrays (details in \emph{OI Biostat})}

\small

\begin{itemize}
\item
  Microarray technology is based on hybridization between two DNA
  strands, in which complementary nucleotide sequences specifically pair
  together.
\item
  The mRNA from a sample is converted into complementary-DNA (cDNA),
  labeled with a fluorescent dye, and added to the microarray.
\item
  When cDNA from the sample encounters complementary DNA probes, the two
  strands will hybridize, allowing the cDNA to adhere to specific spots
  on the slide.
\item
  When the chip is illuminated and scanned, the intensity of
  fluorescence detected at each spot corresponds to the amount of bound
  cDNA.
\item
  DNA microarrays do not directly quantify gene expression levels or
  quantity of mRNA present in a sample.
\item
  The fluorescence intensity data only provide a relative measure of
  gene expression, showing which genes on the chip seem to be more or
  less active in relation to each other.
\end{itemize}

\end{frame}

\begin{frame}{Microarrays}

\includegraphics{figures/microarray_schematic.jpg}

\end{frame}

\begin{frame}{The Golub clinical data}

Demographic variables described in \emph{OI Biostat} Table 1.54:

\scriptsize

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Variable\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Description\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
Samples\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Sample or chip number. The material from each patient was examined on a
separate chip and experimental run.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
BM.PB\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Type of patient material. BM denotes bone marrow; PB denotes a
peripheral blood sample.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
Gender\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
F for female, M for male.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
Source\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Hospital where the patient was treated.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
tissue.mf\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
A variable showing the combination of type of patient material and sex
of the patient. BM:f denotes bone marrow from a female patient,
etc.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
cancer\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
The type of leukemia; aml is acute myeloblastic leukemia, allB is acute
lymphoblastic leukemia which started in B-cells (cells that mature into
plasma cells) origin, and allT is acute lymphoblastic leukemia with
T-cell origin (T-cells are a type of white blood cell).\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\end{frame}

\begin{frame}{The Golub expression data}

The expression data is contained in the last 7,129 columns.

Each column is a variable with a name corresponding to the name of the
probe on the microarray.

The expression levels record fluorescence intensity for each gene.

\begin{itemize}
\item
  The intensity levels have no inherent biological meaning.
\item
  Data have been normalized to adjust for variability between the
  separate arrays used for each patient.
\end{itemize}

\end{frame}

\begin{frame}{Selected variables and columns from Golub data}

\captionsetup[table]{labelformat=empty} \scriptsize

\begin{longtable}[]{@{}rllrrr@{}}
\caption{\emph{OI Biostat} Table 1.40}\tabularnewline
\toprule
Samples & Gender & cancer & AFFX-BioB-5\_at & AFFX-BioB-M\_at &
AFFX-BioB-3\_at\tabularnewline
\midrule
\endfirsthead
\toprule
Samples & Gender & cancer & AFFX-BioB-5\_at & AFFX-BioB-M\_at &
AFFX-BioB-3\_at\tabularnewline
\midrule
\endhead
39 & F & allB & -1363.28 & -1058.59 & -541.47\tabularnewline
40 & F & allB & -796.29 & -1167.10 & 7.54\tabularnewline
42 & F & allB & -679.14 & -1069.83 & -690.30\tabularnewline
47 & M & allB & -1164.40 & -1109.94 & -990.13\tabularnewline
48 & F & allB & -1299.65 & -1402.00 & -1077.54\tabularnewline
\bottomrule
\end{longtable}

\end{frame}

\begin{frame}{Analyzing the Golub leukemia data}

We will do an analysis in class using some of the simple but
surprisingly powerful ideas behind numerical and graphical summaries.

The goal of the Golub study was to develop a procedure for
distinguishing between AML and ALL based only on the gene expression
levels of a patient. There are two major issues to be addressed:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Which genes are the most informative for making a prediction?
\item
  What is a workable strategy for predicting leukemia type from
  expression data for a specific set of genes?
\end{enumerate}

\end{frame}

\begin{frame}[fragile]{Starting small\ldots{}}

\footnotesize

\begin{verbatim}
##    cancer        A         B        C        D
## 69   allB 39307.96 35232.401 41170.76 35792.79
## 67   allT 32281.88 41432.024 59328.51 49608.14
## 55   allB 47429.94 35568.928 56074.96 42857.78
## 56   allB 25533.87 16983.749 28056.75 32693.92
## 59   allB 35960.55 24191.746 27637.90 22240.75
## 52    aml 46177.95  6189.465 12557.24 34485.41
## 53    aml 43790.70 33661.825 38380.30 29758.25
## 51    aml 53420.05 26109.245 31427.20 23809.70
## 50    aml 41241.59 37589.773 47325.77 30099.36
## 54    aml 41300.57 49198.412 66026.10 56248.62
\end{verbatim}

\end{frame}

\end{document}
