% $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 5]{Stat 609: Mathematical Statistics \\ Lecture 5}
\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 5: Random variables and their distributions}
\vspace{-2mm}
\begin{alertblock}{Definition 1.4.1.}
A random variable $X$ is a function from $S$ into a subset of ${\cal R}$ such that 
for any Borel set $B \subset {\cal R}$ $ \{X \in B \} = \{ \omega \in S: X(\omega ) \in B \}$ is an event. 
\end{alertblock}
\vspace{-2mm}
\begin{alertblock}{}<2->
\begin{itemize}
\item
It is convenient to deal with a summary variable than the elements in the original sample space.
\item
The range of a random variables is simpler than $S$.
\item
In some problems, there is a natural random variable; e.g., the number of accidents, number of successes, etc.
In other cases, we may define a random variable according to our interests.
\end{itemize}
\end{alertblock}\vspace{-2mm}
\begin{block}{Example 1.4.3. (Toss a coin 3 times)}<3->
\begin{tabular}{ccccccccc} \hline
outcome  & hhh & hht & hth & thh & tth & tht & htt & ttt \\
$X$: number of heads  & 3 & 2 & 2 & 2 & 1 & 1 & 1 & 0 \\ \hline
\end{tabular}
\begin{itemize}
\item
The range of $X$, $\{0,1,2,3\}$, is simpler than $S$.
\item
$X$ treats hht, hth, thh the same, and tth, tht, htt the same.
\end{itemize}
\end{block}
}
\frame{\vspace{-1mm}
\begin{alertblock}{Induced probability}
The induced probability of $X$ is \vspace{-2mm}
\[ P_X(B) = P(X \in B ) = P(\{ \omega \in S: X(\omega ) \in B \}) \vspace{-2mm}  \]
The probability $P_X$ is called the \cred{distribution} of $X$. 
\end{alertblock}\vspace{-2mm}
\begin{block}{Example 1.4.3 (continued)}<2->
If the coin is fair, then
\begin{center}
\begin{tabular}{ccccc} \hline
$x$ & 0 & 1 & 2 & 3 \\ \hline
$P(X=x)$ & $\frac{1}{8}$ & $\frac{3}{8}$ & $\frac{3}{8}$ & $\frac{1}{8}$ \\
\hline
\end{tabular}
\end{center}
A table like this effective for $X$ taking finite many values. 
\end{block}\vspace{-2mm}
\begin{alertblock}{Definition 1.5.1.}<3->
The cumulative distribution function (cdf) of a random variable $X$, denoted by $F_X(x)$, is defined by \vspace{-2mm}
\[ F_X(x) = P_X(X \leq x ), \quad \quad x \in {\cal R} \]
\end{alertblock}
\vspace{-2mm}
\begin{block}{}<3->
Even if $X$ may not take all real numbers, the cdf is defined for all $x \in {\cal R}$
\end{block}
}
\frame{\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.9in, 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 if $F_X(x)$ is continuous in $x$.\\
A random variable $X$ is discrete if $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.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 \quad x \in {\cal R} \vspace{-2mm}\]
 Hence, $F$ is strictly increasing.
\end{block} \vspace{-2mm}
\begin{alertblock}{Example}<2->
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?
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{alertblock}{}
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}\vspace{-2mm}
\begin{block}{Definition 1.5.8/Theorem 1.5.10.}<2->
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}}
\frame{\vspace{-2mm} 
\begin{block}{}
Note that two identically distributed random variables are not necessarily equal (see Example 1.5.9).
\end{block}
\vspace{-2mm}
\begin{alertblock}{}<2->
The cdf's can be used to calculate various probabilities related to random variables but sometimes it is more convenient to use another function to calculate probabilities.
\end{alertblock}
\vspace{-2mm}
\begin{block}{Definition 1.6.1.}<2->
The probability mass function (pmf) of a discrete random variable $X$ is \vspace{-2mm}
\[ f_X(x) = P(X=x)  \quad \quad x \in {\cal R} \]
\end{block}\vspace{-2mm}
\begin{alertblock}{}<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 Borel set $A$, \vspace{-2.5mm}
\[  P(X \in A) = \sum_{k \in A} f_X(k)  \quad \mbox{and} \quad  F_X(x) = P(X\leq x) = \sum_{k \leq b} f_X(k)  \vspace{-2.5mm} \]
\item
How to obtain the pmf for a discrete random variable $X$?
\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{itemize}
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{alertblock}{Characteristics of a pmf}
\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_i>0$, $i=1,2,...$, satisfy $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}\vspace{-2mm}
\begin{block}{How to define something similar to a pmf for a continuous $X$?}<2->
Defining $f_X(x)=P(X=x)$ does not work for a continuous  $X$.\\
For any $\epsilon >0$, \vspace{-2.5mm}
\[ P(X=x) \leq P( x-\epsilon < X \leq x ) =F_X(x)- F_X(x-\epsilon ) \vspace{-2.5mm}\]
Since $F_X$ is continuous at $x$, we obtain   \vspace{-2mm}
\[ P(X=x) \leq \lim_{\epsilon \rightarrow 0} [F_X(x)- F_X(x-\epsilon )] = 0 \vspace{-3mm}\]
Hence, $P(X=x)=0$ for any $x \in {\cal R}$ (compare this to a discrete $X$).

For a discrete $X$, we have \vspace{-2mm}
\[ F_X(x) = \sum_{k \leq x } f_X(k) \vspace{-3mm} \]
An analog for the continuous case is to replace the sum by an integral.
\end{block}
}
\frame{\vspace{-2mm}
\begin{alertblock}{Definition 1.6.3.}
The probability density function (pdf)  of a continuous random variable $X$ (if it exists) is the function $f_X(x)$ satisfying \vspace{-2mm}
\[ F_X(x) = \int_{-\infty}^x f_X(t) dt \quad\quad x \in {\cal R} \vspace{-1mm}\]
\end{alertblock}\vspace{-2mm}
\begin{block}{}<2->
\vspace{-0.5mm}
\begin{itemize}
\item
Unlike the discrete case, a pdf of a continuous $X$ may not exist.\vspace{-0.5mm}
\item
Unlike the cdf, $f_X$ is not unique.\vspace{-0.5mm}
\item
For a continuous $X$, it is convenient to use the pdf to calculate probabilities\vspace{-0.5mm}
\item
If $F_X$ is differentiable, then $f_X(x) = F_X'(x) = \frac{d}{dx} F_X(x)$.\vspace{-0.5mm}
\item
A continuous random variable has a pdf iff its cdf is absolutely continuous.\vspace{-0.5mm}
\item
If $f$ is a pdf, the set $\{ x: f(x)>0 \}$ is called its support. 
\end{itemize}
\end{block}\vspace{-2mm}
\begin{alertblock}{Theorem 1.6.5.}<3->
A function $f(x)$ is a pdf iff \\
a. $f(x) \geq 0$ for all $x$;\\
b. $\int_{-\infty}^\infty f(x) dx = 1 $.
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{block}{Calculation of probabilities}
For a continuous $X$ with pdf $f_X$,  \vspace{-2mm}
\[ P(X \in A) = \int_A f_X(x)dx \vspace{-2mm} \]
For example, \vspace{-2mm}
\[ P(a<X<b)=P(a<X \leq b)=P(a\leq X<b) \vspace{-2mm}\]
\[ =P(a\leq X \leq b)= F_X(b)-F_X(a) = \int_a^b f_X(t)dt \vspace{-1mm} \]
which is the area under the curve $f_X(t)$.
\end{block}\vspace{-3mm}
\begin{block}{}
\vspace{-2mm}
\begin{figure}[h]
\begin{center}
%\caption{pdf and probabilities (Example 1.6.4).}
\includegraphics[height=1.5in, width=3in]{img2.eps}
\end{center}
\end{figure}
\end{block}
}
\frame{
\begin{alertblock}{Example (finding the cdf, given a pdf)}
Suppose that \vspace{-2mm}
\[ f_X(x) = \left\{ \begin{array}{ll}
1+x & \quad -1 \leq x < 0 \\
1-x & \quad 0 \leq x <1 \\
0 & \quad \mbox{otherwise} \end{array} \right. \vspace{-1mm} \]
$F_X(x)= ?$\\
Obviously, $F_X(x)=0$ when $x < -1$. \\
For $-1 \leq x <0$, \vspace{-1mm}
\[ F_X(x) = \int_{- \infty }^x f_X(t)dt =
\int_{-1}^x (1+t)dt = \frac{t^2}{2}+t \bigg|_{t=-1}^x = \frac{x^2}{2}+x + \frac{1}{2} \vspace{-1mm} \]
For $0\leq x <1$,  \vspace{-1mm}
\[ F_X(x) = \int_{- \infty }^x f_X(t)dt =
\int_{-1}^0  (1+t)dt + \int_0^x (1-t)dt  = \frac{1}{2} -\frac{x^2}{2} + x \vspace{-1mm} \]
For $ x \geq 1$,  \vspace{-1mm}
\[ F_X(x) = \int_{- \infty }^x f_X(t)dt =
\int_{-1}^0  (1+t)dt + \int_0^1 (1-t)dt  = \frac{1}{2} + \frac{1}{2} = 1 \]
\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{alertblock}{Finding the pdf, given a cdf}
\begin{itemize}
\item
If $F_X$ is differentiable everywhere, then $f_X = F_X'$.
\item
What if $F_X$ is differentiable except for some  (at most countably many) points? \\
$f_X(x) = F_X'(x)$ for $x$ at which $F_X$ is differentiable;\\
$f_X(x) $ can be any $c \geq 0$ for $x$ at which $F_X$ is not differentiable.
\end{itemize}
\end{alertblock}\vspace{-2mm}
\begin{block}{Example}<2->
\vspace{-1mm}
\[ F_X(x) = \left\{ \begin{array}{ll}
0 & \quad x <0 \\
x/2 & \quad 0 \leq x < 1/2 \\
x^2 & \quad 1/2 \leq x < 1 \\
1 & \quad x \geq 1 \end{array}\right. \vspace{-1mm}\]
$f_X(x) = ?$\\
$F_X$ is differentiable except at 0, 1/2 and 1. \vspace{-2mm}
\[ f_X(x) = \left\{ \begin{array}{ll}
0 & \quad x <0 \\
1/2 & \quad 0 \leq x < 1/2 \\
2x & \quad 1/2 \leq x < 1 \\
0 & \quad x \geq 1 \end{array}\right. \]
\end{block}
}
\frame{\vspace{-2mm}
\begin{alertblock}{Example.}
What values of $\theta$ and $\beta$ will make $f(x)$ a pdf?
\vspace{-2mm}
\[ f(x) = \beta e^{\theta x - |x| } \quad\quad x \in {\cal R} \vspace{-2mm} \]
If $\theta \geq 1$, then $\lim_{x \rightarrow \infty} e^{\theta x - |x| } = \infty$; if
 $\theta \leq -1$, then $\lim_{x \rightarrow - \infty} e^{\theta x - |x| } = \infty$; hence,
 $\theta$ has to be in $(-1, 1)$.
 \vspace{1mm}

For $\theta \in (-1,1)$, \vspace{-2mm}
\[ \int_{-\infty}^\infty e^{\theta x - |x| } dx = \int_{-\infty}^0 e^{\theta x +x }dx + \int_0^\infty e^{\theta x -x}dx
= \frac{1}{1+\theta} + \frac{1}{1-\theta } = \frac{2}{1-\theta^2} \vspace{-2mm} \]
Hence, in orde to have a pdf, we must have $ \beta = (1-\theta^2)/2$.
\vspace{1mm}

What is the cdf of $f$?

For $x \leq 0$, \vspace{-2mm}
\[ F(x) = \int_{-\infty}^xf(t)dt = \frac{1-\theta^2}{2} \int_{-\infty}^x e^{\theta t+t}dt = \frac{1-\theta}{2} e^{(1+\theta )x} \vspace{-2mm} \]
For $x >0$, \vspace{-2mm}
\[ F(x) = \int_{-\infty}^xf(t)dt = \frac{1-\theta^2}{2} \left[ \int_{-\infty}^0 e^{\theta t+t}dt
+ \int_0^x e^{\theta t - t}dt \right] = 1 - \frac{1+\theta}{2} e^{(1-\theta )x} \]
\end{alertblock}}
\end{document}
