% $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}}
\def\br{\begin{array}}
\def\er{\end{array}}

%%%%%%%%%%%%%%% 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 24]{Stat 609: Mathematical Statistics \\ Lecture 24}
\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}
\def\back{\!\!\!\!\!}

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

\begin{document}

%\frame{\titlepage}

\frame {\vspace{-3mm}
\frametitle{Lecture 24: Noncentral $\chi^2$-, t-, and F-distributions}
\begin{alertblock}{}
The chi-square ($\chi^2$-), t-, and F-distributions previously defined are special cases of the
non-central $\chi^2$-, t-, and F-distributions, respectively, which are useful in statistics.
\end{alertblock}
\vspace{-2mm}
\begin{block}{Definition (the noncentral chi-square distribution)}
Let $X_1,...,X_n$ be independent random variables and
$X_i \sim N(\mu_i,\sigma^2)$, $i=1,...,n$. The distribution of the random
variable $Y = (X_1^2 +\cdots + X_n^2)/\sigma^2$ is called the
\cblue{noncentral chi-square} distribution with degrees of freedom $n$ and the noncentrality parameter
$\delta = (\mu_1^2+ \cdots + \mu_n^2)/\sigma^2$.
\end{block}\vspace{-2mm}
\begin{alertblock}{}<2->
The chi-square distribution defined earlier is
a special case of the noncentral chi-square distribution
with $\delta
=0$ and, therefore, is sometimes called a central chi-square distribution.
\vspace{1.5mm}

It follows from the definition of noncentral
chi-square distributions that if $Y_1,...,Y_k$ are independent
random variables and $Y_i$ has the noncentral chi-square distribution with degrees of freedom
$n_i $ and the
\end{alertblock}
}
\frame{
\begin{alertblock}{}
noncentrality parameter $\delta_i$, $i=1,...,k$, then
$Y=Y_1+\cdots + Y_k$ has the noncentral chi-square distribution with degrees of freedom
$n_1+\cdots + n_k$ and the noncentrality parameter $\delta_1+ \cdots + \delta_k$.
\end{alertblock}\vspace{-2mm}
\begin{block}{Theorem (properties of the noncentral chi-square distribution)}<2->
Let $Y$ be a random variable having the noncentral chi-square
distribution with degrees of freedom $k$ and noncentrality parameter $\delta$.
\begin{itemize}
\item[(i)]
The pdf of $Y$ is \vspace{-2mm}
\[ g_{\delta , k} (x) =
e^{-\delta /2} \sum_{j=0}^\infty \frac{(\delta /2)^j}{j!} f_{2j+k}(x), \vspace{-3mm} \]
where $f_v(x)$
is the pdf of the central chi-square distribution with degrees of freedom $v$, $v=1,2,...$;
\item[(ii)] The mgf of  $Y$ is \vspace{-1mm}
\[ \frac{ e^{\delta t/(1-2t)}}{(1-2 t)^{ k/2}}, \quad\quad t < 1/2;\vspace{-2mm} \]
\item[(iii)]
$E(Y) = k+\delta$;
\item[(iv)]
 Var$(Y) = 2k +4\delta$.
\end{itemize}
\end{block}}
\frame{
\begin{block}{Proof.}
We first prove result (ii).
\vspace{1mm}

Let $X_k$ be a random variable having the standard normal distribution
and $\mu = \sqrt{\delta} $ be a positive number.
\vspace{1mm}

For $t<1/2$, the mgf of $(X_k+\mu )^2$ is \vspace{-2mm}
\beqrs
\psi_\delta (t) \back &=& \back
\frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty  e^{-x^2/2}e^{t(x+\mu )^2} dx\\
&=& \back \frac{e^{\mu^2 t/(1-2t)}}{\sqrt{2\pi}}
\int_{-\infty}^\infty  e^{ -(1-2t)[x-2\mu t/(1-2t)]^2/2} dx\\
&=& \back \frac{e^{\delta t/(1-2t)}}{ \sqrt{1-2t}} .
\end{eqnarray*}
$~~$ \vspace{-5mm}

By definition, $Y \sim X_1^2+\cdots +
X_{k-1}^2 + (X_k + \sqrt{\delta})^2$,
where $X_i$'s are independent and have the standard normal distribution.
\vspace{1mm}

From the obtained result, the mgf of $Y$ is \vspace{-2mm}
\[ E\left\{ e^{t[X_1^2+ \cdots + X_{k-1}^2+(X_k+\sqrt{\delta})^2]}\right\}
= [\psi_0(t)]^{k-1} \psi_{\sqrt{\delta}}(t)
=   \frac{e^{\delta  t/(1-2t)}}{ (1-2t)^{k/2}} . \]
\end{block}}
\frame{\vspace{-2mm}
\begin{block}{}
We now use the proved result (ii) to show result (i).
\vspace{1mm}

By the uniqueness of the mfg, it suffices to show that the pdf $g_{\delta,k}(x)$ in (i) has mgf exactly the same as the one in (ii).
\vspace{1mm}

Note that the mgf of the central chi-square
distribution with degrees of freedom $v$ is, \vspace{-1mm}
\[ \frac{1}{(1-2t)^{v/2}}  , \quad\quad t < 1/2 , \vspace{-1mm} \]
The mgf of the pdf $g_{\delta,k}(x)$ in (i) is, for $t<1/2$, \vspace{-2mm}
\begin{eqnarray*}
\int_{-\infty}^\infty e^{tx} g_{\delta , k} (x) dx
\back &=& \back e^{-\delta/2} \int_{-\infty}^\infty \sum_{j=0}^\infty \frac{(\delta/2)^j}{j!}
 e^{tx} f_{2j+k} (x) dx  \\
\back &=& \back e^{-\delta/2} \sum_{j=0}^\infty \frac{(\delta/2)^j}{j!}
\int_{-\infty}^\infty  e^{tx} f_{2j+k} (x) dx  \\
&=& \back e^{-\delta/2} \sum_{j=0}^\infty \frac{(\delta/2)^j}{j!(1-2t)^{(j+k/2)}} \\
&=& \back \frac{e^{-\delta/2}}{(1-2t)^{k/2}}\sum_{j=0}^\infty
\frac{\{\delta/[2(1-2t)]\}^j}{j!}
\eeqrs
 \end{block}
}
\frame{
\begin{block}{}
\[ = \frac{e^{-\delta/2+\delta/[2(1-2t)]}}{(1-2t)^{k/2}}
= \frac{e^{\delta t/(1-2t)}}{(1-2t)^{k/2}}\]
To establish (iii), let $X_i$'s be as defined in the proof of (i).
\vspace{1mm}

 Then, \vspace{-2mm}
\beqrs
 E(Y) \back & = & \back E(X_1^2) + \cdots + E(X_{k-1}^2) + E(X_k+\sqrt{\delta})^2 \\
& = & \back k-1 + E(X_k^2) + \delta + E(2 \sqrt{\delta} X_k) \\
& = & \back k + \delta
\eeqrs
$~~$ \vspace{-7mm}

because $E(X_i^2) =1$ and $E(X_i) =0$.
\vspace{1mm}

To show (iv), note that Var$(X_i^2)=2$ and
Cov$(X_k^2,X_k) = E(X_k^3)  =0$.
\vspace{1mm}

 Then, \vspace{-2mm}
\beqrs
\mbox{Var}(Y) \back & = & \back \mbox{Var}(X_1^2) + \cdots +
\mbox{Var}(X_{k-1}^2) + \mbox{Var}\bigl((X_k+\sqrt{\delta})^2\bigr) \\
& = & \back 2(k-1) + \mbox{Var}(X_k^2+ 2\sqrt{\delta}X_k)\\
& = & \back 2(k-1) + \mbox{Var}(X_k^2) + 4 \delta \mbox{Var}(X_k)
+ 4\sqrt{\delta} \mbox{Cov}(X_k^2,X_k) \\
& = & \back 2k + 4 \delta
\eeqrs

\end{block}}
\frame{
\begin{alertblock}{Definition (the noncentral t-distribution)}
Let $X \sim N(\delta , 1 )$, $\delta \in {\cal R}$, $U \sim $ the central chi-square with degrees of freedom $n$, and $X$ and $U$ be independent.
The distribution of $T= X/\sqrt{U/n}$ is the \cred{noncentral t-distribution} with degrees of freedom $n$ and noncentral parameter $\delta $.
\end{alertblock}
\vspace{-2mm}
\begin{block}{}
The t-distribution previously defined can be
called a central t-distribution, since it is
a special case of the noncentral t-distribution with $\delta =0$.

 Using the formula for the ratio of two independent random variables, we can show that $T$ has the following pdf: \vspace{-2mm}
\[ \frac{1}{2^{(n+1)/2} \Gamma (n/2) \sqrt{\pi n}}
\int_0^\infty y^{(n-1)/2} e^{-[(x\sqrt{y/n}-\delta)^2+y]/2} dy \vspace{-2mm} \]
Since $U \sim $ the central chi-square with degrees of freedom $n$, $W = \sqrt{U/n}$ has pdf \vspace{-2mm} 
\[ \frac{2n^{n/2}}{\Gamma (n/2) 2^{n/2}} w^{n-1} e^{-nw^2/2}, \quad\quad w> 0  \]
\end{block}
}
\frame{
\begin{block}{}
Then, $T$ has pdf \vspace{-2mm} 
\beqrs
& & \back 
 \int_0^\infty w  \left( \frac{n^{n/2}}{\Gamma (n/2) 2^{n/2-1}} w^{n-1} e^{-nw^2/2} \right) 
 \left( \frac{1}{\sqrt{2\pi} } e^{-(x w-\delta )^2/2 } \right) dw \\
 & = & \back \frac{n^{n/2}}{\Gamma (n/2) 2^{(n-1)/2}\sqrt{\pi}} \int_0^\infty w^n e^{[(xw-\delta)^2 + nw^2]/2 } dw 
 \eeqrs
 $~~$ \vspace{-5mm}
 
 Letting $y = nw^2$, we obtain the desired result. 
 \vspace{1.5mm}
 
 By the independence of $X$ and $U$ and the fact that $X \sim N(\delta , 1)$ and $U \sim $ the central chi-square, \vspace{-2mm} 
 \beqrs
  E(T) \back & = & \back E\left( \frac{X}{\sqrt{U/n}}\right) = \sqrt{n}  E( X ) E \left(\frac{1}{\sqrt{U}}\right) \\
 \back & = & \back  
  \sqrt{n} \delta \int_0^\infty  
 \frac{1}{\sqrt{u}}  \left( \frac{1}{\Gamma (n/2) 2^{n/2} } u^{n/2 -1} e^{-u/2}\right) du \\
 \back & = & \back 
 \frac{ \sqrt{n} \delta}{\Gamma (n/2) 2^{n/2} } \int_0^\infty
  u^{(n-1)/2 -1} e^{-u/2} du = 
 \frac{ \sqrt{n} \delta \Gamma((n-1)/2)}{\sqrt{2} \Gamma (n/2) }    
 \eeqrs
$~~$ \vspace{-5mm} 

when $n >1$ and is $\infty$ when $n=1$. 
 \end{block}
}
\frame{\vspace{-2mm}
\begin{block}{} \vspace{-5mm}
\beqrs
  E(T^2) \back & = & \back E\left( \frac{X^2}{U/n}\right) = n  E( X^2 ) E \left(\frac{1}{U}\right) \\
 \back & = & \back
  n(1+ \delta^2)\frac{1}{\Gamma (n/2) 2^{n/2} } \int_0^\infty
  u^{n/2 -2} e^{-u/2}du \\
\back & = & \back
 \frac{ n(1+ \delta^2)}{\Gamma (n/2) 2^{n/2} } \Gamma(n/2-1)2^{n/2-1} = \frac{n(1+\delta^2)}{n-2}  
 \eeqrs
 $~~$ \vspace{-5mm}
 
 when $n>2$ and is $\infty$ when $n \leq 2$. 
 \vspace{1mm}
 
 Hence, when $n>2$, 
 \vspace{-3mm} 
 \[ {\rm Var}(T) =  \frac{n(1+\delta^2)}{n-2} -  \frac{n\delta^2 }{2} \left[ \frac{ \Gamma((n-1)/2)}{\Gamma (n/2) }\right]^2  \]
\end{block}\vspace{-2mm}
\begin{alertblock}{Definition (the noncentral F-distribution)}<2->
Let $X_1 \sim $  the noncentral chi-square
distribution with degrees of freedom $n_1$ and noncertrality parameter $\delta \geq 0$, $X_2 \sim $ the central
chi-square distribution with degrees of freedom $n_2$, and $X_1$ and $X_2$ be 
independent. The distribution of $F= (X_1/n_1)/(X_2/n_2)$ is called the
\cred{noncentral F-distribution} with degrees of freedom  $n_1$ and $n_2$ and noncentrality parameter $\delta $.
\end{alertblock}}
\frame{
\begin{alertblock}{}
The F-distribution introduced previously can be 
called a central F-distribution, since
it is a special case of the noncentral F-distribution with $\delta =0$.

Using the formula for the ratio of two independent random variables and the pdf of $X_1$ we derived previously, we obtain 
 the following pdf for $F = (X_1/n_1)/(X_2/n_2)$: \vspace{-2mm} 
\beqrs


It can be shown (exercise) that
the noncentral F-distribution $F_{n_1,n_2}(\delta)$
has
\[ e^{-\delta /2}  \sum_{j=0}^\infty \frac{n_1(\delta/2)^j}{ j!
(2j+n_1)} f_{2j+n_1,n_2}\left( \frac{n_1x}{2j+n_1}\right),\]
where $f_{k_1,k_2}(x)$ is the pdf of the central
F-distribution $F_{k_1,k_2}$ given in Table 1.2.

\end{alertblock}
}
\frame{\vspace{-2mm}
\begin{block}{}
Suppose that $Z \sim exponential (\beta)$. Then\vspace{-2mm}
\[ E(X) = E[E(X|Y)] = pE(Y) = p E[E(Y|Z)] = pE(Z)= p \beta \vspace{-2mm} \]
The three-stage model can be thought of as a two-stage model by combining the last two stages; we just need to obtain the marginal distribution of $Y$.\vspace{-2mm} \beqrs
 P(Y=y) &=& \int_0^\infty f(y|z)f_Z(z)dz = \int_0^\infty \frac{e^{-z} z^y}{y!} \frac{1}{\beta} e^{-z/\beta } dz \\
 & = & \frac{1}{\beta y!} \int_0^\infty z^y e^{-z(1+\beta^{-1})} dz =
 \frac{1}{\beta y!} \Gamma (y+1) \frac{1}{(1+\beta^{-1})^{y+1}} \\
 & = & \frac{1}{\beta } \frac{\beta^{y+1}}{(1+\beta)^{y+1}} =
 \frac{1}{1+\beta } \left( 1- \frac{1}{1+\beta} \right)^y
\eeqrs
which is the geometric distribution with probability $(1+ \beta)^{-1}$, i.e.,
\vspace{-2mm}
\beqrs
\mbox{number of survivors $X$ from $Y$ eggs} & & X|Y \sim binomial(p, Y) \\
\mbox{number of eggs $Y$} &  & Y \sim geometric((1+\beta )^{-1})
\eeqrs
However, the three-stage model is easier to understand.
\end{block}
}
\frame{
\begin{alertblock}{Calculation of mean and variance}
Aside from the advantage in understanding models, hierarchical models can often make the calculation of mean and variance easier.

Let $X$ be a random variable having a pdf that is the so-called noncentral chi-square pdf with noncentrality parameter $\lambda$ and degrees of freedom
$n$: \vspace{-2mm}
\[ f_X(x) = \sum_{k=1}^\infty \frac{x^{n/2+k-1} e^{-x/2}}{\Gamma ( n/2+k) 2^{n/2+k} } \frac{\lambda^ke^{-\lambda}}{k!} \quad \quad x>0  \vspace{-2mm}  \]
Calculating $E(X)$ is not easy.

However, the pdf is the marginal pdf of $X$ in the following two-stage model: \vspace{-2mm}
\[ X|K \sim \mbox{chi square with degrees of freedom $n+2K$} , \quad \quad K \sim Poisson (\lambda ) \vspace{-2mm} \]
Then \vspace{-2mm}
\[ E(X) = E[E(X|K)] = E(n+2K) = n+ 2E(K) = n+2\lambda \]
\end{alertblock}}
\frame{
\begin{block}{Example 4.4.6.}
Suppose that \vspace{-2mm}
\[ X|P \sim binomial (n,P) , \quad\quad P \sim beta(\alpha , \beta ) \]
How to calculate $E(X)$ and Var$(X)$?
\[ E(X) = E[E(X|P)] = E(nP) = nE(P) = \frac{n\alpha}{\alpha + \beta } \]
Using the variance formula derived previously, \vspace{-2mm}
\beqrs
{\rm Var}(X) &=& {\rm Var}(E(X|P)) + E[ {\rm Var}(X|P)] \\
& = & {\rm Var}(nP) + E[ nP(1-P)] \\
&=& n^2 {\rm Var}(P) +n E(P)-nE(P^2) \\
&=& \frac{n^2 \alpha\beta }{(\alpha +\beta )^2 (\alpha + \beta +1)} +
\frac{n \alpha}{\alpha + \beta } - \frac{n \alpha (\alpha +1)}{(\alpha + \beta )(\alpha + \beta +1)} \vspace{1mm} \\
& = & \frac{n\alpha \beta (\alpha + \beta +n)}{(\alpha + \beta)^2(\alpha + \beta + 1)}
\eeqrs
\end{block}
}
\end{document}

\vspace{-2mm}
\[ f_j(t)=\left\{ \br{ll}
\frac{1}{\Gamma (j/2) 2^{j/2}}t^{j/2-1}e^{-t/2} & \quad t > 0 \\
0 & \quad t \leq 0 \er \right. \vspace{-2mm} \]
