% $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}}
\def\beqrs{\begin{eqnarray*}}           %\beqrs
\def\eeqrs{\end{eqnarray*}}             %\eeqrs

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

\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 13]{Stat 609: Mathematical Statistics \\ Lecture 13}
\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 { \vspace{-3mm}
\frametitle{
Lecture 13: Continuous distributions}
\begin{alertblock}{Uniform distribution}
The uniform distribution on the interval $[a,b] $, where $a$ and $ b$ are real numbers with $a < b$, has pdf \vspace{-2mm}
\[ f(x) = \left\{ \begin{array}{ll}
\frac{1}{b-a} & \quad a\leq x \leq b \vspace{2mm}\\
0 & \quad \mbox{otherwise} \end{array} \right. \vspace{-2mm}  \]
If $X \sim f$, then \vspace{-2mm} 
\[ E(X) = \frac{1}{b-a} \int_a^b x dx = \frac{x^2}{2(b-a)} \bigg|_a^b = \frac{b^2-a^2}{2(b-a)} = \frac{a+b}{2} \vspace{-1mm}\]
\[ E(X^2) = \frac{1}{b-a} \int_a^b x^2 dx = \frac{x^3}{3(b-a)} \bigg|_a^b = \frac{b^3-a^3}{2(b-a)} =\frac{b^2+a^2+ab}{3}  \vspace{-1mm}\]
\[ {\rm Var}(X) = E(X^2)- [E(X)]^2 = \frac{b^2+a^2+ab}{3} - \frac{(a+b)^2 }{4} = \frac{(b-a)^2}{12} \vspace{-1mm} \]
\[ M_X(t) = \frac{1}{b-a} \int_a^b e^{tx}dx = \frac{e^{tb} - e^{ta}}{t(b-a)}, \quad t \in {\cal R} \]
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{block}{Normal distribution}
The normal distribution plays a central role in statistics.
\begin{itemize}
\item
The normal distributions and distributions associated with it are very tractable analytically.
\item
The normal distribution has the familiar bell shape, whose symmetry makes it an appealing choice for many population models.
\item
Under the Central Limit Theorem (Chapter 5), the normal distribution can be used to approximate a large variety of distributions in large samples. 
\end{itemize} 
Let $\mu \in {\cal R}$ and $\sigma >0$ be two constants. 

The normal distribution $N(\mu, \sigma^2)$ has pdf \vspace{-2mm}
\[ f(x) = \frac{1}{\sqrt{2\pi} \sigma} e^{-(x-\mu)^2/(2\sigma^2)}, \quad x \in {\cal R} \vspace{-2mm} \]
When $\mu = 0 $ and $\sigma =1$, $N(0,1)$ is called the standard normal distribution. 

We first need to show that $f$ is indeed a pdf. 
\end{block}}
\frame{
\begin{block}{}
By the transformation $z = (x-\mu)/\sigma$, \vspace{-2mm}
\[ \frac{1}{\sqrt{2\pi } \sigma} \int_{-\infty}^\infty e^{-(x-\mu)^2/(2\sigma^2)} dx = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty 
e^{-z^2/2} dz = \frac{2}{\sqrt{2 \pi}} \int_0^\infty e^{-z^2/2} dz \vspace{-2mm}\]
because $e^{-z^2/2}$ is symmetric. 

Note that \vspace{-2mm}
\beqrs
\left( \int_0^\infty e^{-z^2/2} dz\right)^2 & = & \left( \int_0^\infty e^{-z^2/2} dz\right)\left( \int_0^\infty e^{-u^2/2} du\right)^2 
= \int_0^\infty \int_0^\infty e^{-(z^2+u^2)/2} du dz \\
& = &  \int_0^\infty \int_0^{\pi/2} r e^{-r^2/2} d\theta dr \\
\end{block}
}
\frame{\vspace{-2mm}
\begin{block}{Poisson distribution}
The Poisson distribution with parameter $\lambda >0$ has pmf \vspace{-2mm}
\[ f(x) \left\{ \begin{array}{ll}
\frac{\lambda^x e^{-\lambda}}{x!} & \quad x=0,1,2,... \vspace{1mm} \\
0 & \quad \mbox{otherwise}, \end{array} \right. \vspace{-2mm} \]
The mgf has been obtained previously, which is  $e^{\lambda (e^{t}-1)}$, $\ t \in {\cal R}$.

If $X \sim f$, then \vspace{-2mm}
\[ E(X) = \frac{d}{dt} e^{\lambda (e^{t}-1)} \bigg|_{t=0} = \lambda e^{t} e^{\lambda (e^{t}-1)}\bigg|_{t=0} = \lambda \vspace{-2mm} \]
\[ E(X^2) = \lambda \frac{d}{dt} e^t e^{\lambda (e^{t}-1)}\bigg|_{t=0} =
\lambda \left[ e^t e^{\lambda (e^{t}-1)} + e^t \lambda e^t e^{\lambda (e^{t}-1)}\right] \bigg|_{t=0} = \lambda + \lambda^2 \vspace{-1mm} \]
Hence, \vspace{-1mm}
\[ {\rm Var}(X) = E(X^2)-[E(X)]^2 = \lambda + \lambda^2 - \lambda^2 = \lambda \]
\end{block}\vspace{-2mm}
\begin{alertblock}{Example 3.2.4 (Waiting time)}<2->
As an example of a waiting-for-occurrence application, consider a telephone operator who, on the average, handles 5 calls every 3 minutes.
\end{alertblock}
}
\frame{
\begin{alertblock}{}
Let $X =$ number of calls in a minute.

Assume that $X$ follows a Poisson distribution.

What is $\lambda $?

 $E(X) =$ average of calls in a minute.

Hence $\lambda = E(X) = 5/3$.

What is the probability that there will be no calls in the next minute? \vspace{-2mm}
\[ P(X=0) = \frac{e^{-5/3} (5/3)^0}{0!} = e^{-5/3} = 0.189  \vspace{-1mm}\]
What is the probability that there will be at least two calls? \vspace{-2mm}
\[ P(X \geq 2 ) = 1-P(X=0)-P(X=1) = 1-0.189 -
\frac{e^{-5/3} (5/3)^1}{1!} = 0.496  \]
\end{alertblock}
\vspace{-2mm}
\begin{block}{Recursion relation}<2->
If $X \sim$ Poisson with mean $\lambda$, then \vspace{-2mm}
\[ P(X=x) = \frac{\lambda^x e^{-\lambda}}{x!} = \frac{\lambda}{x}  \frac{\lambda^{x-1} e^{-\lambda}}{(x-1)!} =
\frac{\lambda}{x} P(X=x-1), \quad x=1,2,... \vspace{-1mm}\]
This helps the computation of probabilities.
\end{block}
}
\frame{
\begin{block}{}
The recursion relation also tells us that, for any fixed $\lambda$, $P(X=x)$ is decreasing for $x \geq x_0$ with a fixed $x_0$.

If $Y \sim$ binomial with size $n$ and probability $p$, then, for $x=1,...,n$,  \vspace{-2mm}
\beqrs
P(Y=x ) & =&  {n \choose x} p^x(1-p)^{n-x} = \frac{n!}{x!(n-x)!} p^x(1-p)^{n-x} \\
& = &  \frac{n-(x-1)}{x} \frac{n!}{(x-1)!(n-x+1)!} \frac{p}{1-p}  p^{x-1}(1-p)^{n-x+1} \\
& = & \frac{n-(x-1)}{x}  \frac{p}{1-p}  {n \choose x-1} p^{x-1}(1-p)^{n-(x-1)} \\
&= & \frac{n-x+1}{x} \frac{p}{1-p} P(Y=x-1)
\eeqrs
If $p=p_n \rightarrow 0$ as $n \rightarrow \infty$ and $np = np_n \rightarrow \lambda >0$, then \vspace{-2mm}
\[ P(Y=x ) \approx \frac{\lambda}{x} P(Y=x-1), \quad x=1,2,... \vspace{-1mm}\]
which is the same as the recursion relation for the Poisson distribution with mean $\lambda $.
\end{block}}
\frame{\vspace{-3mm}
\begin{block}{}
Hence, the Poisson approximates the binomial, $P(X=x) \approx P(Y=x)$ for all $x$, if we can show that
$P(X=0) \approx P(Y=0)$, which is justified by  \vspace{-2mm}
\[ P(Y=0) = (1-p)^n = \left( 1- \frac{np}{n} \right)^n \rightarrow e^{-\lambda } = P(X=0) \]
\end{block}\vspace{-2mm}
\begin{alertblock}{Negative binomial}
Let $r$ be a positive integer and $p \in [0,1]$. \\
 The negative binomial pmf is \vspace{-2mm}
\[ f(x) = \left\{ \begin{array}{ll}
{x-1 \choose r-1} p^r(1-p)^{x-r} & \quad x=r,r+1,... \vspace{1mm} \\
0 & \quad \mbox{otherwise}, \end{array} \right. \vspace{-4mm} \]
\begin{itemize}
\item
In a sequence of independent Bernoulli trials with probability $p$, if $X$ is the number of trials needed to have the $r$th success (1 in the Bernoulli trial), then $X \sim f$.
\item
If $Y = X-r$ (the number of 0's before the $r$th 1), then \vspace{-2mm}
\[ P(Y=y ) = {r+y-1 \choose y} p^r(1-p)^y , \quad y=0,1,2,... \vspace{-2mm} \]
This is also called the negative binomial distribution.
\end{itemize}
\end{alertblock}
}
\frame{
\begin{alertblock}{}
The expectation of the negative binomial distribution (2nd definition) is \vspace{-2mm}
\beqrs
E(Y) = & = & \sum_{y=0}^\infty y {r+y-1 \choose y} p^r(1-p)^y =
 \sum_{y=1}^\infty \frac{(r+y-1)!}{(y-1)!(r-1)!} p^r(1-p)^y \\
 &= & \sum_{y=1}^\infty r {r+y-1 \choose y-1}  p^r(1-p)^y  =
 \sum_{z=0}^\infty r {r+z \choose z}  p^r(1-p)^{z+1} \\
 & = & \frac{r(1-p)}{p}
 \sum_{z=0}^\infty r {(r+1)+(z-1) \choose z}  p^{r+1}(1-p)^{z} \\
   & = & \frac{r(1-p)}{p}
   \eeqrs
The expectation of the negative binomial distribution (1st definition) is \vspace{-2mm}
\[ E(X) = E(Y)+r = \frac{r(1-p)}{p} + r = \frac{r}{p} \vspace{-1mm} \]
A similar calculation shows \vspace{-2mm}
\[ {\rm Var}(Y) = {\rm Var}(X) = \frac{r(1-p)}{p^2} \]
\end{alertblock}
}
\frame{
\begin{block}{Geometric distribution}
Geometric distribution is a special case of negative binomial distribution with $r=1$.

In the 1st definition of negative binomial distribution, \vspace{-2mm}
\[ f(x) = \left\{ \begin{array}{ll}
 p(1-p)^{x-1} & \quad x=1,2,... \vspace{1mm} \\
0 & \quad \mbox{otherwise}, \end{array} \right. \vspace{-2mm} \]
In the 2nd definition of negative binomial distribution, \vspace{-2mm}
\[ f(x) = \left\{ \begin{array}{ll}
 p(1-p)^{x} & \quad x=0,1,2,... \vspace{1mm} \\
0 & \quad \mbox{otherwise}, \end{array} \right.  \]
\end{block}
}
\end{document}
