% $Header: /cvsroot/latex-beamer/latex-beamer/examples/beamerexample5.tex,v 1.22 2004/10/08 14:02:33 tantau Exp $

\documentclass[11pt]{beamer}
\usepackage{amscd}

%\usetheme{Madrid} % Darmstadt, Boadilla


\mode<presentation> {
  \usetheme{Madrid}
  \setbeamercovered{transparent}
}

\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsbsy,alltt,amsmath,times}
\usepackage{epsfig, color, graphicx, rotate, colordvi}
%\usepackage{fancybox,fancyhdr,times,subfigure}
\usepackage{hyperref, mathptmx}


\setbeamercovered{dynamic}

\newcommand{\Lang}[1]{\operatorname{\text{\textsc{#1}}}}

\newcommand{\Class}[1]{\operatorname{\mathchoice
  {\text{\sf \small #1}}
  {\text{\sf \small #1}}
  {\text{\sf #1}}
  {\text{\sf #1}}}}

\newcommand{\NumSAT}      {\text{\small\#SAT}}
\newcommand{\NumA}        {\#_{\!A}}

\newcommand{\barA}        {\,\bar{\!A}}

\newcommand{\Nat}{\mathbb{N}}
\newcommand{\Set}[1]{\{#1\}}

\newtheorem{thm}{Result}%[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{exam}{Example}%[section]
\newtheorem{rem}{Remark}

\newcommand{\cred}{\textcolor {red}}
\newcommand{\cblue}{\textcolor {blue}}
\newcommand{\cgreen}{\textcolor {green}}

\def\ul{\underline}

\def\sign{\;{\rm sign}}
\def\rank{\;{\rm rank}}
\def\disp{\displaystyle}
\def\sn{\sqrt{n}}
\def\Pr{\mathrm{P}}

\def\Cov{\;{\rm Cov}}
\def\L{\underline L}
\def\LL{\overline L}

\def\balpha{{\boldsymbol{\alpha}}}
\def\cal{\mathcal}
\def\conas{\stackrel{a.s.} {\longrightarrow}}         % conv. a.s.
\def\conp{\stackrel{\cal P} {\longrightarrow}}        % conv. in probability
\def\conD{\stackrel{\mathcal{L}} {\longrightarrow}}        % conv. in distribution
\def\conw{\stackrel{\mathcal{L}} {\rightarrow}}        % conv. in distribution
\def\hat{\widehat}
%\def\endproof{\begin{flushright}$\lozenge$\end{flushright}}
\def\Proof{\noindent{\it Proof }}
\def\endproof{\hfill{$\Box$}}
\newcommand{\wcon}{\stackrel{\mathcal{L}}{\longrightarrow}}
\def\Var{\mbox{var}}

%%%%%%%%%%%%%%% MY DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Put your own definitions
%
\def\VaR{{\rm VaR}}
\def\E{{\rm E}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pgfdeclaremask{tu}{beamer-tu-logo-mask}
\pgfdeclaremask{computer}{beamer-computer-mask}
\pgfdeclareimage[interpolate=true,mask=computer,height=2cm]{computerimage}{beamer-computer}
\pgfdeclareimage[interpolate=true,mask=computer,height=2cm]{computerworkingimage}{beamer-computerred}
\pgfdeclareimage[mask=tu,height=.5cm]{logo}{beamer-tu-logo}

\logo{\pgfuseimage{logo}}

\title[Stat 609 Lecture 6]{Stat 609: Mathematical Statistics \\ Lecture 6}
\author[UW-Madison]{Jun Shao}
\institute[Statistics]{%
%  Department of Statistics\\
%  University of Wisconsin\\
%  Madison, WI 53706, USA\\
%~~~\\
  }
\date[2014]{}

\colorlet{redshaded}{red!25!bg}
\colorlet{shaded}{black!25!bg}
\colorlet{shadedshaded}{black!10!bg}
\colorlet{blackshaded}{black!40!bg}

\colorlet{darkred}{red!80!black}
\colorlet{darkblue}{blue!80!black}
\colorlet{darkgreen}{green!80!black}

\def\radius{0.96cm}
\def\innerradius{0.85cm}

\def\softness{0.4}
\definecolor{softred}{rgb}{1,\softness,\softness}
\definecolor{softgreen}{rgb}{\softness,1,\softness}
\definecolor{softblue}{rgb}{\softness,\softness,1}

\definecolor{softrg}{rgb}{1,1,\softness}
\definecolor{softrb}{rgb}{1,\softness,1}
\definecolor{softgb}{rgb}{\softness,1,1}

\newcommand{\Bandshaded}[2]{
  \color{shadedshaded}
  \pgfmoveto{\pgfxy(-0.5,0)}
  \pgflineto{\pgfxy(-0.6,0.1)}
  \pgflineto{\pgfxy(-0.4,0.2)}
  \pgflineto{\pgfxy(-0.6,0.3)}
  \pgflineto{\pgfxy(-0.4,0.4)}
  \pgflineto{\pgfxy(-0.5,0.5)}
  \pgflineto{\pgfxy(4,0.5)}
  \pgflineto{\pgfxy(4.1,0.4)}
  \pgflineto{\pgfxy(3.9,0.3)}
  \pgflineto{\pgfxy(4.1,0.2)}
  \pgflineto{\pgfxy(3.9,0.1)}
  \pgflineto{\pgfxy(4,0)}
  \pgfclosepath
  \pgffill

  \color{black}
  \pgfputat{\pgfxy(0,0.7)}{\pgfbox[left,base]{#1}}
  \pgfputat{\pgfxy(0,-0.1)}{\pgfbox[left,top]{#2}}
}

\newcommand{\Band}[2]{
  \color{shaded}
  \pgfmoveto{\pgfxy(-0.5,0)}
  \pgflineto{\pgfxy(-0.6,0.1)}
  \pgflineto{\pgfxy(-0.4,0.2)}
  \pgflineto{\pgfxy(-0.6,0.3)}
  \pgflineto{\pgfxy(-0.4,0.4)}
  \pgflineto{\pgfxy(-0.5,0.5)}
  \pgflineto{\pgfxy(4,0.5)}
  \pgflineto{\pgfxy(4.1,0.4)}
  \pgflineto{\pgfxy(3.9,0.3)}
  \pgflineto{\pgfxy(4.1,0.2)}
  \pgflineto{\pgfxy(3.9,0.1)}
  \pgflineto{\pgfxy(4,0)}
  \pgfclosepath
  \pgffill

  \color{black}
  \pgfputat{\pgfxy(0,0.7)}{\pgfbox[left,base]{#1}}
  \pgfputat{\pgfxy(0,-0.1)}{\pgfbox[left,top]{#2}}
}

\newcommand{\BaenderNormal}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Band{input tapes}{}}
  \pgfputat{\pgfxy(0.35,4.6)}{\pgfbox[center,base]{$\vdots$}}
  \pgfputat{\pgfxy(0,4)}{\Band{}{}}

  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$w_1$}}

  \pgfxyline(0,4)(0,4.5)
  \pgfxyline(1.8,4)(1.8,4.5)
  \pgfputat{\pgfxy(0.25,4.25)}{\pgfbox[left,center]{$w_n$}}
  \ignorespaces}

\newcommand{\BaenderZweiNormal}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Band{Zwei Eingabebänder}{}}
  \pgfputat{\pgfxy(0,4.25)}{\Band{}{}}

  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$u$}}

  \pgfxyline(0,4.25)(0,4.75)
  \pgfxyline(1.8,4.25)(1.8,4.75)
  \pgfputat{\pgfxy(0.25,4.5)}{\pgfbox[left,center]{$v$}}
  \ignorespaces}

\newcommand{\BaenderHell}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Bandshaded{input tapes}{}}
  \color{shaded}
  \pgfputat{\pgfxy(0.35,4.6)}{\pgfbox[center,base]{$\vdots$}}
  \pgfputat{\pgfxy(0,4)}{\Bandshaded{}{}}

  \color{blackshaded}
  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$w_1$}}

  \pgfxyline(0,4)(0,4.5)
  \pgfxyline(1.8,4)(1.8,4.5)
  \pgfputat{\pgfxy(0.25,4.25)}{\pgfbox[left,center]{$w_n$}}
  \ignorespaces}

\newcommand{\BaenderZweiHell}
{%
  \pgfsetlinewidth{0.4pt}
  \color{black}
  \pgfputat{\pgfxy(0,5)}{\Bandshaded{Zwei Eingabebänder}{}}%
  \color{blackshaded}
  \pgfputat{\pgfxy(0,4.25)}{\Bandshaded{}{}}
  \pgfputat{\pgfxy(0.25,4.5)}{\pgfbox[left,center]{$v$}}
  \pgfputat{\pgfxy(0.25,5.25)}{\pgfbox[left,center]{$u$}}%

  \pgfxyline(0,5)(0,5.5)
  \pgfxyline(1.2,5)(1.2,5.5)

  \pgfxyline(0,4.25)(0,4.75)
  \pgfxyline(1.8,4.25)(1.8,4.75)
  \ignorespaces}

\newcommand{\Slot}[1]{%
  \begin{pgftranslate}{\pgfpoint{#1}{0pt}}%
    \pgfsetlinewidth{0.6pt}%
    \color{structure}%
    \pgfmoveto{\pgfxy(-0.1,5.5)}%
    \pgfbezier{\pgfxy(-0.1,5.55)}{\pgfxy(-0.05,5.6)}{\pgfxy(0,5.6)}%
    \pgfbezier{\pgfxy(0.05,5.6)}{\pgfxy(0.1,5.55)}{\pgfxy(0.1,5.5)}%
    \pgflineto{\pgfxy(0.1,4.0)}%
    \pgfbezier{\pgfxy(0.1,3.95)}{\pgfxy(0.05,3.9)}{\pgfxy(0,3.9)}%
    \pgfbezier{\pgfxy(-0.05,3.9)}{\pgfxy(-0.1,3.95)}{\pgfxy(-0.1,4.0)}%
    \pgfclosepath%
    \pgfstroke%
  \end{pgftranslate}\ignorespaces}

\newcommand{\SlotZwei}[1]{%
  \begin{pgftranslate}{\pgfpoint{#1}{0pt}}%
    \pgfsetlinewidth{0.6pt}%
    \color{structure}%
    \pgfmoveto{\pgfxy(-0.1,5.5)}%
    \pgfbezier{\pgfxy(-0.1,5.55)}{\pgfxy(-0.05,5.6)}{\pgfxy(0,5.6)}%
    \pgfbezier{\pgfxy(0.05,5.6)}{\pgfxy(0.1,5.55)}{\pgfxy(0.1,5.5)}%
    \pgflineto{\pgfxy(0.1,4.25)}%
    \pgfbezier{\pgfxy(0.1,4.25)}{\pgfxy(0.05,4.15)}{\pgfxy(0,4.15)}%
    \pgfbezier{\pgfxy(-0.05,4.15)}{\pgfxy(-0.1,4.2)}{\pgfxy(-0.1,4.25)}%
    \pgfclosepath%
    \pgfstroke%
  \end{pgftranslate}\ignorespaces}

\newcommand{\ClipSlot}[1]{%
  \pgfrect[clip]{\pgfrelative{\pgfxy(-0.1,0)}{\pgfpoint{#1}{4cm}}}{\pgfxy(0.2,1.5)}\ignorespaces}

\newcommand{\ClipSlotZwei}[1]{%
  \pgfrect[clip]{\pgfrelative{\pgfxy(-0.1,0)}{\pgfpoint{#1}{4.25cm}}}{\pgfxy(0.2,1.25)}\ignorespaces}


\AtBeginSection[]{\frame{\frametitle{Outline}\tableofcontents[current]}}

\begin{document}

%\frame{\titlepage}

\frame {
\frametitle{
Lecture 6: Density and mass functions}
\vspace{-3mm}
\begin{alertblock}{}
The cdf's can be used to calculate various probabilities related to random variables.

It may be more convenient to use another function to calculate probabilities.
\end{alertblock}
\vspace{-3mm}
\begin{block}{Definition 1.6.1.}<2->
The probability mass function (pmf) of a discrete random variable $X$ is given by \vspace{-1mm}
\[ f_X(x) = P(X=x) , \quad \quad x \in {\cal R} \]
\end{block}\vspace{-3mm}
\begin{block}{}<3->
\begin{itemize}
\item
For discrete $X$, $f_X(x) >0$ for only countably many $x$'s.
\item
$f_X(x)$ is the size of the jump in the cdf $F_X$ at $x$.
\item
For any constants $a \leq b$, \vspace{-2mm}
\[ P(a \leq X \leq b ) = \sum_{k=a}^b f_X(k) \vspace{-2mm} \]
\[ F_X(b) = P(X\leq b) = \sum_{k \leq b} f_X(k) \]
\end{itemize}
\end{block}
}
\frame{
\begin{alertblock}{Example 1.6.2.}
In Example 1.5.4, $X$ has the pmf\vspace{-1mm}
\[ f_X(x) = \left\{ \begin{array}{ll}
(1-p)^{x-1}p & \quad x=1,2,... \vspace{2mm}\\
0 & \quad \mbox{otherwise} \end{array} \right. \vspace{-1mm} \]
where $0 < p < 1$.
\end{alertblock}\vspace{-2mm}
\begin{block}{How to obtain the pmf for a discrete random variable $X$?}<2->
\begin{itemize}
\item
List all values $X$ can take (with positive probabilities), $x_1,x_2,...$
\item
Find $P(X=x_i)$, $i=1,2,...$
\end{itemize}
\end{block}\vspace{-2mm}
\begin{alertblock}{Characteristics of a pmf}<3->
\begin{itemize}
\item
For any pmf $f$, $f(x) \geq 0$, $x \in {\cal R}$ and there is $\{x_1,x_2,...\}$ such that
$ f(x_1)+f(x_2)+\cdots  = 1.$
\item
If $p_1, p_2,...$ are numbers satisfying (i) $p_i  > 0$ and (ii) $p_1+p_2+ \cdots =1$,
then $f(x_i) = p_i$, $i=1,2,...$, is a pmf, where $x_1,x_2,...$ can be arbitrary. 
\end{itemize}
\end{alertblock}}
\frame{
\begin{alertblock}{Continuous random variables}
Defining $f_X(x)=P(X=x)$ does not work for a continuous random variable $X$.\\
For any $\epsilon >0$,  
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{block}{Discussion}
Even if $X$ may not take all real numbers, the cdf is defined for all $x \in {\cal R}$
\end{block}\vspace{-2mm}
\begin{alertblock}{Example 1.4.3 (continued)}
The cdf of $X$ is a step function\vspace{-2mm}
\[ F_X(x) = \left\{ \begin{array}{ll}
0 & \quad - \infty < x < 0  \\
0.125 & \quad 0 \leq x < 1  \\
0.5 & \quad 1 \leq x < 2  \\
0.875 & \quad 2 \leq x < 3 \\
1 & \quad 3 \leq x < \infty \end{array} \right.  \]
\vspace{-6mm}
\begin{figure}[h]
\begin{center}
%\caption{cdf in Example 1.4.3.}
\includegraphics[height=1.5in, width=3in]{img1.eps}
\end{center}
\end{figure}
\end{alertblock}
}
\frame{
\begin{block}{Theorem 1.5.3.}
The function $F(x)$ is a cdf iff\\
a. $\lim_{x \rightarrow - \infty} F(x) = 0$ and $\lim_{x \rightarrow \infty} F(x)=1$;\\
b. $F(x)$ is nondecreasing in $x$;\\
c. $F(x)$ is right-continuous: $\lim_{\epsilon \rightarrow 0, \epsilon >0} F(x+\epsilon )=F(x)$ for any $x \in {\cal R}$.
\end{block}\vspace{-2mm}
\begin{block}{}<2->
This theorem says that
\begin{itemize}
\item
 if $F$ is the cdf of a random variable $X$, then $F$ satisfies a-c (this is easy to prove);
 \item
  if $F$ satisfies
a-c, then there exists a random variable $X$ such that the cdf of $X$ is $F$ (this is not easy to prove).
\end{itemize}
\end{block}\vspace{-2mm}
\begin{alertblock}{Definition 1.5.7.}<3->
A random variable $X$ is continuous iff $F_X(x)$ is continuous in $x$.\\
A random variable $X$ is discrete iff $F_X(x)$ is a step function of $x$.
\end{alertblock}\vspace{-2mm}
\begin{alertblock}{}<3->
There are random variables that are
neither discrete nor continuous; e.g., a mixture of the two types.
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{block}{Example 1.5.4 (Tossing for a head)}
We have already seen a discrete cdf in Example 1.4.3. \\
Here is another one.  \\
Suppose we toss a coin independently until a head appears, with $p=$ probability of a head on any given toss. \\
$X =$ number of tosses required to get a head. \\
For $k =1,2,...$, \vspace{-2mm}
\[ P(X=k) = (1-p)^{k-1}p \vspace{-2mm}\]
For $x =1,2,...$, \vspace{-2mm}
\[ F_X(x)= P(X \leq x ) = P\left(\bigcup_{k=1}^x \{ X=k\}\right) = \sum_{k=1}^x P(X=k) \vspace{-2mm}\]
\[ = \sum_{k=1}^x (1-p)^{k-1}p
= \frac{1-(1-p)^x}{1-(1-p)}p = 1-(1-p)^x \vspace{-2mm}\]
For $x <y<x+1$, $F_X(y)=F_X(x)$.\\
Thus\vspace{-2mm}
\[ F_X( y) = \left\{\begin{array}{ll}
0 &  \quad y<1  \\
1-(1-p)^x & \quad x \leq y < x+1 \end{array} \right. \quad\quad x=1,2,... \]
\end{block}
}
\frame{
\begin{block}{Example 1.5.5 (logistic distribution)}
An example of a continuous cdf is \vspace{-2mm}
\[ F(x) = \frac{1}{1+e^{-x}}, \quad \quad x \in {\cal R}\vspace{-2mm}\]
It satisfies a-c in Theorem 1.5.3, because \vspace{-2mm}
\[ \lim_{x \rightarrow -\infty } \frac{1}{1+e^{-x}} = 0, \quad \quad
 \lim_{x \rightarrow \infty } \frac{1}{1+e^{-x}} = 1 \vspace{-2mm} \]
 $F$ is continuous everywhere; in fact, it is differentiable everywhere with \vspace{-2mm}
 \[ \frac{d}{dx} F(x) = F'(x) = \frac{e^{-x}}{(1+e^{-x})^2} > 0 \quad x \in {\cal R} \vspace{-2mm}\]
 Hence, $F$ is strictly increasing.
\end{block} \vspace{-2mm}
\begin{alertblock}{Example 1.5.6 (a cdf that is neither continuous nor discrete)}<2->
Consider \vspace{-2mm}
\[ F(x) = \left\{ \begin{array}{ll}
\frac{1-\epsilon}{1+e^{-x}} & \quad x <0 \vspace{2mm} \\
\epsilon + \frac{1-\epsilon}{1+e^{-x}} & \quad x \geq 0 \end{array} \right.\vspace{-2mm}
 \]
where $\epsilon $ is a constant and $0 < \epsilon < 1$.
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{alertblock}{Example}
Let $c$ be a constant and \vspace{-2mm}
\[ G_c(x) = \left\{ \begin{array}{ll}
0 & \quad x < 0 \\
1-c e^{-3x} & \quad x \geq 0 \end{array} \right. \vspace{-2mm} \]
For what values of $c$, $G_c$ is a cdf?

Clearly, \vspace{-2mm}
\[ \lim_{x \rightarrow -\infty } G_c(x) = 0 , \quad \quad \lim_{x \rightarrow \infty }G_c(x) = 1 \vspace{-2mm}\]
\[ G'_c(x) = \left\{ \begin{array}{ll}
0 & \quad x < 0 \\
3c e^{-3x} & \quad x > 0 \end{array} \right. \vspace{-3mm} \]
\begin{itemize}
\item
If $c<0$, $G_c$ is decreasing.
\item
If $c >1$, $G_c(0) = 1 - c <0$.
\item
If $0 \leq c \leq 1$, then $G_c$ is nondecreasing.
\item
$G_c$ is always right-continuous.
\end{itemize}
Hence, $G_c$ is a cdf iff $0\leq c \leq 1$. \\
If $c=1$, then $G_c$ is continuous.\\
If $c=0$, then $G_c$ is a special discrete cdf. \\
If $0<c<1$, then $G_c$ is neither continuous nor discrete.
\end{alertblock}
}
\frame{
\begin{block}{Definition 1.5.8/Theorem 1.5.10. }
Two random variables $X$ and $Y$ with cdf's $F_X$ and $F_Y$ respectively are identically distributed iff
$F_X(x)=F_Y(x)$ for any $x \in {\cal R}$, which is equivalent to
$P(X \in B)= P(Y \in B)$ for any Borel set $B$.
\end{block}\vspace{-2mm}
\begin{block}{}<2->
Note that two identically distributed random variables are not necessarily equal.
\end{block}\vspace{-2mm}
\begin{alertblock}{Example 1.5.9.}<2->
Consider the experiment of tossing a fair coin independently three times as in Example 1.4.3. \\
Define
$X = $number of heads observed,\\
$Y =$number of tails observed.   \\
The cdf of $X$ is given in Example 1.4.3.\\
Since $X = 3-Y$, $P(X=Y) = 0$ and\vspace{-2mm}
\[ P(Y=k )= P(X = 3-k) = P(X=k) , \quad \quad k=0,1,2,3. \vspace{-2mm}\]
Hence, the cdf of $Y$ is the same as that of $X$, but $P(X \neq Y)=1$.
\end{alertblock}
}
\end{document}
