% \documentclass[mathserif]{beamer} % Get Computer Modern math font.
\documentclass[serif, handout]{beamer} % Handout mode to ignore pause statements
\hypersetup{colorlinks,linkcolor=,urlcolor=red}
\usetheme{AnnArbor}  % CambridgeUS Blue and yellow, Shows current section title
% \usetheme{Berlin} % Blue: Displays section titles on top
% \usetheme{Frankfurt}  % Displays section titles on top: Fairly thin but still swallows some material at bottom of crowded slides
\usefonttheme{serif} % Looks like Computer Modern for non-math text -- nice!
\setbeamertemplate{navigation symbols}{} % Supress navigation symbols at bottom
% \usetheme{Berlin} % Diplays sections on top
% \usetheme{Warsaw} % Diplays sections on top
% \usetheme{Frankfurt}  % Diplays sections on top: Fairly thin but swallows some material at bottom of crowded slides
\usepackage[english]{babel}
\setbeamertemplate{footline}[frame number] 

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

\title{Survival and Hazard Functions\footnote{See last slide for copyright information.}}
\subtitle{STA 312 Spring 2019}
\date{} % To suppress date


\begin{document}

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

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

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

\begin{frame}
\frametitle{Background Reading}
%\framesubtitle{} 

{\large
Chapter Two in \emph{Applied Survival Analysis Using R}
} % End size
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Maybe omit
% \begin{frame}
% \frametitle{Overview}
% \tableofcontents
% \end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Survival and Hazard Functions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Survival Function} \pause
\framesubtitle{} 
Let $T$ be a continuous random variable with $P(T>0)=1$. It will represent time to failure.  \pause The \emph{survival function} is the probability of lasting past time $t$. \pause
{\LARGE
\begin{eqnarray*}
    S(t) & \stackrel{def}{=} & P(T > t) \\ \pause
         & = & 1 - F(t)  \\ \pause
         & = & \int_t^\infty f(x) \, dx
\end{eqnarray*} 
} % End size
\end{frame}

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

\begin{frame}
\frametitle{The hazard function $h(t)$} \pause
%\framesubtitle{} 
\begin{itemize}
    \item Idea: The probability of dying at time $t$ given that you have lived this long. \pause
    \item But the probability of dying at exactly time $t$ is zero. \pause
    \item So consider the probability of dying in in the next \emph{instant} following $t$, given that you have lived to time $t$. \pause 
    \item The meaning of \emph{instant} is a tiny interval of time\pause, length $\Delta$. \pause  
\begin{center} $P(t < T < t + \Delta|T>t)$ \end{center} \pause
    \item This clearly depends on the length of the time interval $\Delta$. \pause So make the conditional probability \emph{relative} to the length of time $\Delta$. \pause
\begin{center} $\displaystyle \frac{P(t < T < t + \Delta|T>t)}{\Delta}$ \end{center} \pause
    \item To capture the idea of a \emph{really} tiny interval, let $\Delta \rightarrow 0$. \pause This leads to the definition \pause
\end{itemize}
\begin{displaymath}
    h(t) \stackrel{def}{=}  \lim_{\Delta \rightarrow 0} 
                            \frac{P(t < T < t + \Delta|T>t)}{\Delta}
\end{displaymath}
\end{frame}

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

\begin{frame}
\frametitle{The Hazard Function}
%\framesubtitle{Also called the \emph{intensity function} or the \emph{force of mortality}} 
{\LARGE
\begin{displaymath}
    h(t) \stackrel{def}{=}  \lim_{\Delta \rightarrow 0} 
                            \frac{P(t < T < t + \Delta|T>t)}{\Delta}
\end{displaymath}
} % End size
where $\Delta>0$.  \pause
\vspace{4mm}

It will be shown that 
{\LARGE
\begin{displaymath}
    h(t) = \frac{f(t)}{S(t)}
\end{displaymath}
} % End size
\end{frame}

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

\begin{frame}
\frametitle{The Cumulative Hazard Function}
%\framesubtitle{} 
{\LARGE
\begin{eqnarray*}
    H(t) & = & \pause \int_0^t h(x) \, dx \\ \pause
         & \stackrel{show}{=} & -\log S(t)
\end{eqnarray*} \pause
} % End size

So that 
{\LARGE
\begin{displaymath}
    S(t) = e^{-\int_0^t h(x) \, dx}
\end{displaymath} 
} % End size
\end{frame}

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

\begin{frame}
\frametitle{Density, Cumulative Distribution Function, Survival Function and Hazard Function are all Equivalent} \pause
%\framesubtitle{} 
\begin{eqnarray*}
    f(t) & = & F^\prime(t) \\
    F(t) & = & \int_{-\infty}^t f(x) \, dx \\ \pause
    S(t) & = & 1-F(t) \\ 
    h(t) & = & \frac{f(t)}{S(t)} \\ 
    S(t) & = & e^{-\int_0^t h(x) \, dx} 
\end{eqnarray*}  \pause
\begin{itemize}
    \item With one function, it is easy to obtain the others. \pause
    \item We will focus on the hazard function.
\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/312s19} {\footnotesize \texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/312s19}}

\end{frame}

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

\end{document}

