% $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 18]{Stat 609: Mathematical Statistics \\ Lecture 18}
\author[UW-Madison]{Jun Shao}
\institute[Statistics]{%
%  Department of Statistics\\
%  University of Wisconsin\\
%  Madison, WI 53706, USA\\
%~~~\\
  }
\date[2015]{}

\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{-2mm}
\frametitle{
Lecture 18: Sampling distributions}
\begin{alertblock}{}
In many applications, the population is one or several normal distributions
(or approximately). \vspace{1mm}

We now study properties of some important statistics based on a random sample from a normal distribution.
\vspace{1mm}

If $X_1,...,X_n$ is a random sample from $N(\mu,\sigma^2)$, then the joint pdf is \vspace{-2mm}
\[ \frac{1}{(2\pi)^{n/2} \sigma^n} \exp \left( - \frac{1}{2\sigma^2} \sum_{i=1}^n (x_i - \mu)^2 \right) , \quad \quad x_i \in {\cal R}, i=1,...,n \]
\end{alertblock}\vspace{-2mm}
\begin{block}{Theorem 5.3.1.}
Let $X_1,...,X_n$ be a random sample from $N(\mu,\sigma^2)$ and let $\bar{X}$ and $S^2$ be the sample mean and sample variance. Then\\
a. $\bar{X}$ and $S^2$ are independent random variables; \\
b. $\bar{X} \sim N(\mu, \sigma^2/n)$; \\
c. $(n-1)S^2/\sigma^2$ has the chi-square distribution with $n-1$ degrees of $\quad$  freedom.
\end{block}}
\frame{\vspace{-2mm}
\begin{block}{Proof.}
We have already established property b (Chapter 4).

To prove property a, it is enough to show the independence of $\bar{Z}$ and $S_Z^2$,
the sample mean and variance based on $Z_i = (X_i-\mu)/\sigma \sim N(0,1)$, $i=1,...,n$,
because we can apply Theorem 4.6.12 and \vspace{-3mm}
\[ \bar{X} = \sigma \bar{Z} -\mu \quad  \mbox{and} \quad  S^2 = \frac{\sigma^2}{n-1} \sum_{i=1}^n (Z_i-\bar{Z})^2
= \sigma^2 S^2_Z \vspace{-3mm}\]
 Consider the transformation \vspace{-2mm}
 \[ Y_1 = \bar{Z}, \quad \quad Y_i = Z_i-\bar{Z} , \quad i=2,...,n, \vspace{-3mm} \]
 Then \vspace{-2mm}
 \[ Z_1= Y_1 - (Y_2+\cdots + Y_n) , \quad  Z_i = Y_i + Y_1 , \quad i=2,...,n, \vspace{-3mm} \]
  and\vspace{-2mm}
  \[\left| \frac{\partial (Z_1,...,Z_n)}{\partial (Y_1,...,Y_n)} \right| = \frac{1}{n} \vspace{-1mm} \]
Since the joint pdf of $Z_1,...,Z_n$ is \vspace{-3mm}
\[ \frac{1}{(2\pi)^{n/2}} \exp \left( - \frac{1}{2} \sum_{i=1}^n z_i^2 \right) \quad \quad z_i \in {\cal R}, i=1,...,n, \]
\end{block}}
\frame{\vspace{-2mm}
\begin{block}{}
the joint pdf of $(Y_1,...,Y_n)$ is \vspace{-2mm}
\beqrs
&&  \frac{n}{(2\pi)^{n/2}} \exp \left( - \frac{1}{2} \left( y_1 - \sum_{i=2}^n y_i\right)^2 \right)
\exp \left( - \frac{1}{2} \sum_{i=2}^n (y_i+y_1)^2 \right) \\
 &=& \!\!\!\! \frac{n}{(2\pi)^{n/2}} \exp \left( - \frac{n}{2} y_1^2 \right)
\exp \left( - \frac{1}{2} \left[\sum_{i=2}^n y_i^2 + \left( \sum_{i=2}^n y_i\right)^2 \right]  \right)
\quad \br{c}
y_i \in {\cal R} \\
i=1,...,n. \er
\eeqrs
 Since the first exp factor involves $y_1$ only and the second exp factor involves $y_2,...,y_n$, we conclude (Theorem 4.6.11) that
 $Y_1$ is independent of $(Y_2,...,Y_n)$.

Since\vspace{-2mm}
\[ Z_1-\bar{Z} = - \sum_{i=2}^n (Z_i - \bar{Z}) = -\sum_{i=2}^n Y_i  \quad \mbox{and} \quad
Z_i-\bar{Z} = Y_i, \quad i=2,...,n,  \vspace{-2mm} \]
we have \vspace{-2mm}
\[ S^2_Z = \frac{1}{n-1}\sum_{i=1}^n (Z_i-\bar{Z})^2 =
 \frac{1}{n-1} \left( \sum_{i=2}^n Y_i \right)^2 +
\frac{1}{n-1}\sum_{i=2}^n Y_i^2 \]
 \end{block}}
\frame{
\begin{block}{}
which is a function of $(Y_2,...,Y_n)$.

Hence, $\bar{Z}$ and $S^2_Z$ are independent by Theorem 4.6.12.

This proves a.
\vspace{1mm}

Finally, we prove c (the proof in the textbook can be simplified).

Note that \vspace{-2mm}
\[ (n-1)S^2 = \sum_{i=1}^n (X_i-\bar{X})^2 =
 \sum_{i=1}^n (X_i-\mu + \mu -\bar{X})^2 =
 \sum_{i=1}^n (X_i-\mu)^2 + n(\mu-\bar{X})^2 \vspace{-2mm} \]
Then\vspace{-2mm}
\[ n\left(\frac{\bar{X}-\mu}{\sigma}\right)^2 + \frac{(n-1)S^2}{\sigma^2}
= \sum_{i=1}^n\left( \frac{X_i-\mu}{\sigma}\right)^2 = \sum_{i=1}^n Z_i^2  \vspace{-2mm} \]
Since $Z_i \sim N(0,1)$ and  $Z_1,...,Z_n$ are independent,
we have previously shown that
\begin{itemize}
\item
each $Z_i^2 \sim $ chi-square with degree of freedom 1,
\item
the sum $\sum_{i=1}^nZ_i^2 \sim$ chi-square with degrees of freedom $n$,
and its mgf is $(1-2t)^{-n/2}$, $t< 1/2$,
\item
$\sqrt{n}(\bar{X}-\mu)/\sigma \sim N(0,1)$ and hence $n[(\bar{X}-\mu)/\sigma ]^2 \sim $ chi-square with degree of freedom 1.
\end{itemize}
\end{block}}
\frame{\vspace{-2mm}
\begin{block}{}
The left hand side of the previous expression is a sum of two independent random variables and, hence, if $f(t)$ is the mgf of $(n-1)S^2/\sigma^2$, then
the mgf of the sum on the left hand side is \vspace{-3mm}
\[ (1-2t)^{-1/2} f(t) \vspace{-3mm} \]
Since the right hand side of the previous expression has mgf $(1-2t)^{-n/2}$, we must have
\vspace{-3mm}
\[ f(t) = (1-2t)^{-n/2}/ (1-2t)^{-1/2} = (1-2t)^{-(n-1)/2} \quad \quad t < 1/2 \vspace{-3mm}\]
This is the mgf of the chi-square with degrees of freedom $n-1$, and the result follows.
\end{block}\vspace{-2mm}
\begin{alertblock}{}
The independence of $\bar{X}$ and $S^2$ can be established in other ways.
\end{alertblock}\vspace{-2mm}
\begin{block}{t-distribution}
Let $X_1,...,X_n$ be a random sample from $N(\mu, \sigma^2)$.
\vspace{1mm}

Using the result in Chapter 4 about a ratio of independent normal and chi-square random variables, the ratio \vspace{-3mm}
\[ \frac{\bar{X}- \mu}{S/\sqrt{n} } = \frac{(\bar{X}-\mu)/(\sigma/\sqrt{n})}{\sqrt{[(n-1)S^2/\sigma^2]/(n-1)} }
\]
\end{block}}
\frame{\vspace{-2mm}
	\begin{block}{}
has the central t-distribution with $n-1$ degrees of freedom.
\vspace{1mm}

What is the distribution of $T_0 =\frac{\bar{X}- \mu_0 }{S/\sqrt{n} } $ for a fixed known constant $\mu_0 \in {\cal R}$
which is not necessarily equal to $\mu$?
\vspace{1mm}

Note that $T$ is not a statistic while $T_0$ is a statistic.
\vspace{1mm}

Since $\bar{X} - \mu_0 \sim N( \mu-\mu_0 , \sigma^2/n)$, from the discussion in Chapter 4 we know that the distribution of $T_0$ is the noncentral t-distribution with  degrees of freedom $n-1$ and noncentrality parameter $\delta = \sqrt{n} (\mu-\mu_0)/\sigma$.
\end{block}\vspace{-2mm}
\begin{alertblock}{F-distribution}
Let $X_1,...,X_n$ be a random sample from $N(\mu_x, \sigma_x^2)$, $Y_1,...,Y_m$ be a random sample from $N(\mu_y,\sigma_y^2)$,
$X_i$'s and $Y_i$'s  be independent, and
 $S_x^2$  and $S_y^2$ be the sample variances based on $X_i$'s and $Y_i$'s, respectively.
\vspace{1mm}

From the previous discussion, $(n-1)S_x^2/\sigma_x^2 $ and
$(m-1)S_y^2/\sigma_y^2 $ are both chi-square distributed, and the ratio
$ \frac{S_x^2/\sigma_x^2}{S_y^2/\sigma_y^2} $
has the F-distribution with degrees of freedom $n-1$ and $m-1$ (denoted by $F_{n-1,m-1}$).
\end{alertblock}}
\frame{
\vspace{-2mm}
\begin{block}{Theorem 5.3.8.}
Let $F_{p,q}$ denote the F-distribution with degrees of freedom $p$ and $q$.

a. If $X \sim F_{p,q}$, then $1/X \sim  F_{q,p}$.

b. If $X $ has the t-distribution with degrees of freedom $q$, then $X^2 \sim F_{1,q}$.

c. If $X \sim F_{p.q}$, then $ (p/q)X/[1+(p/q)X] \sim beta(p/2,q/2)$.
\end{block}\vspace{-2mm}
\begin{block}{Proof.}
We only need to prove c, since
properties a and b follow directly from the definitions of F- and t-distributions. 
\vspace{1mm}

Note that $Z = (p/q)X$ has pdf \vspace{-3.5mm} 
\[ \frac{\Gamma[(p+q)/2]}{
 \Gamma(p/2)\Gamma(q/2)}
 \frac{z^{p/2-1}}{(1+z)^{(p+q)/2}},  \quad \quad \quad z>0 \vspace{-3.5mm} \]
 If $u= z/(1+z)$, then $z = u/(1-u)$, $dz = (1-u)^{-2} du$, and the pdf of $U=Z/(1+Z)$ is \vspace{-3.5mm} 
 \[ \begin{aligned}
 & \quad \frac{\Gamma[(p+q)/2]}{
 \Gamma(p/2)\Gamma(q/2)} \left(\frac{u}{1-u}\right)^{p/2 -1} 
 \frac{1}{(1-u)^{-(p+q)/2}} \frac{1}{(1-u)^2} \\
 &= 
\frac{\Gamma[(p+q)/2]}{
 \Gamma(p/2)\Gamma(q/2)} u^{p/2 -1} (1-u)^{q/2-1} \quad \quad\quad u >0 
 \end{aligned}  \]
\end{block}
}
\frame {\vspace{-2mm}	
	\begin{block}{Definition 5.4.1 (Order statistics).}
		The order statistics of a random sample of univariate $X_1,...,X_n$ are the sample values placed in a non-decreasing order, and
		they are denoted by $X_{(1)},...,X_{(n)}$.
	\end{block}
	\vspace{-3mm}
	\begin{block}{}
		Once $X_{(1)},...,X_{(n)}$ are given, the information  left in the sample is the particular positions from which $X_{(i)}$ is
		observed, $i=1,...,n$.
	\end{block}\vspace{-2mm}
		\begin{alertblock}{Functions of order statistics}
			Many useful statistics are functions of order statistics.
			\begin{itemize}
				\item
				Both sample mean and variance are functions of order statistics, because 
				\[ \sum_{i=1}^n X_i =  \sum_{i=1}^n X_{(i)}
\quad \mbox{and} \quad  \sum_{i=1}^n X_i^2 =  \sum_{i=1}^n X_{(i)}^2 \] 
				\item
				The {\bf sample range} $R= X_{(n)}-X_{(1)}$, the distance between the smallest and largest observations, is a measure of the dispersion in the sample and should reflect the dispersion in the population.
									\end{itemize}
		\end{alertblock}}
		\frame{
			\begin{alertblock}{}
				\begin{itemize}
					\item
					For any fixed $p \in (0,1)$, the $(100p)$th {\bf sample percentile} is the observation such that about $np$ of the observations are less than this observation and
					$n(1-p)$ of the observations are greater:
					\vspace{-2mm} 
				\[ \br{ll}
					X_{(1)} & \quad \mbox{if $p \leq (2n)^{-1}$} \\
					X_{(\{np\})} & \quad \mbox{if $(2n)^{-1} < p < 0.5 $}\\
					X_{((n+1)/2)} & \quad \mbox{if $p=0.5$ and $n$ is odd} \\
					(X_{(n/2)}+X_{(n/2+1)} )/2 & \quad
					\mbox{if $p=0.5$ and $n$ is even} \\
					X_{(n+1-\{n(1-p)\})} & \quad \mbox{if $0.5 < p < 1-(2n)^{-1}$}\\
					X_{(n)} & \quad \mbox{if $p \geq 1- (2n)^{-1}$} \er \vspace{-2mm}\]
					where $\{b\}$ is the number $b$ rounded to the nearest integer, i.e., if
					$k$ is an integer and $k -0.5 \leq b < k + 0.5$, then $\{b\}=k$. \vspace{1mm}
					
					Other textbooks may define sample percentiles differently.
					\item
					The {\bf sample median} is the 50th sample percentile.
					
					It is a measure of location, alternative to the sample mean.					
					\item
					The {\bf sample lower quartile} is the 25th sample percentile and the {\bf upper quartile} is the 75th sample percentile.
					\item
					The {\bf sample mid-range} is defined as $V= (X_{(1)}+X_{(n)})/2$.
				\end{itemize}
			\end{alertblock}}
			\frame{\vspace{-2mm}
				\begin{block}{}
					If $X_1,...,X_n$ is a random sample of discrete random variables, then the calculation of probabilities for the order statistics is mainly a counting task.
				\end{block}\vspace{-2mm}
				\begin{block}{Theorem 5.4.3.}
					Let $X_1,...,X_n$ be a random sample from a discrete distribution with pmf $f(x_i) = p_i$, where $x_1 < x_2 < \cdots $ are the possible values of $X_1$.
					Define\vspace{-2mm}
					\[ P_0 = 0, \ P_1=p_1 , \ ... , \ P_i = p_1+\cdots + p_i , \ ... \vspace{-2mm} \]
					Then, for the $j$th order statistic $X_{(j)}$, \vspace{-2mm}
					\[ P( X_{(j)} \leq x_i ) = \sum_{k=j}^n {n \choose k} P_i^k(1-P_i)^{n-k} \vspace{-2mm} \]
					\[ P(X_{(j)}=x_i) =  \sum_{k=j}^n {n \choose k} [P_i^k(1-P_i)^{n-k} - P_{i-1}^k (1-P_{i-1})^{n-k} ] \]
				\end{block}\vspace{-2mm}
				\begin{block}{Proof.}
					For any fixed $i$, let $Y$ be the number of $X_1,...,X_n$ that are less than or equal to $x_i$.
				\end{block}
			}
			\frame{\vspace{-2mm}
				\begin{block}{}
					If the event $\{X_j \leq x_i \}$ is a ``success", then $Y$ is the number of successes in $n$ trials and is distributed
					as $binomial (n,P_i)$.
					
					Then, the result follows from $\{X_{(j)} \leq x_i \} = \{ Y \geq j \}$, \vspace{-2mm}
					\[ P(  X_{(j)} \leq x_i ) = P(Y \geq j)  = \sum_{k=j}^n {n \choose k} P_i^k(1-P_i)^{n-k} \vspace{-2mm} \]
					and $P(X_{(j)}=x_i) =P(  X_{(j)} \leq x_i )- P(  X_{(j)} \leq x_{i-1} )$.
				\end{block}\vspace{-2mm}
				\begin{alertblock}{}
					If $X_1,...,X_n$ is a random sample from a continuous population with pdf $f(x)$, then \vspace{-2mm}
					\[ P( X_{(1)} < X_{(2)} < \cdots < X_{(n)} ) = 1 \vspace{-2mm}\]
					i.e., we do not need to worry about ties, and the joint pdf of $(X_{(1)},...,X_{(n)})$ is \vspace{-2mm}
					\[ h(x_1,...,x_n) = \left\{ \br{ll}
					n! f(x_1)\cdots f(x_n) & \quad  x_1 < x_2 < \cdots < x_n \vspace{2mm} \\
					0 & \quad \mbox{otherwise} \er \right.\vspace{-2mm} \]
					The $n!$ naturally comes into this formula because, for any set of values $x_1,...,x_n$, there are $n!$ equally likely assignments for these values to $X_1,...,X_n$ that all yield the same values for the order statistics.
				\end{alertblock}
			}
			\frame{
				\begin{alertblock}{Theorem 5.4.4.}
					Let $X_{(1)},...,X_{(n)}$ be the order statistics of a random sample $X_1,...,X_n$ from a continuous population with cdf $F$ and pdf $f$.
					
					Then the pdf of
					$X_{(j)}$ is \vspace{-2mm}
					\[ f_{X_{(j)}}(x) = \frac{n!}{(j-1)! (n-j)!} [F(x)]^{j-1}[1-F(x)]^{n-j} f(x) \quad \quad x \in {\cal R} \]
				\end{alertblock}
				\vspace{-2mm}
				\begin{alertblock}{Proof.}
					Let $Y$ be the number of $X_1,...,X_n$ less than or equal to $x$.
					
					Then, similar to the proof of Theorem 5.4.3, $Y \sim binomial(n,F(x))$, $\{ X_{(j)} \leq x \} = \{ Y \geq j\}$ and \vspace{-2mm}
					\[ F_{X_{(j)}} (x) = P(X_{(j)} \leq x ) = P(Y\geq j) = \sum_{k=j}^n {n \choose k} [F(x)]^k [1-F(x)]^{n-k} \vspace{-2mm} \]
					We now obtain the pdf of $X_{(j)}$ by differentiating the cdf $F_{X_{(j)}}$:\vspace{-2mm}
					\[ f_{X_{(j)}}(x) = \frac{d}{dx} F_{X_{(j)}} (x) = \sum_{k=j}^n {n \choose k} \frac{d}{dx}  [F(x)]^k [1-F(x)]^{n-k} \]
				\end{alertblock}}
				\frame{\vspace{-2mm}
					\begin{alertblock}{}
						\vspace{-5mm}
						\beqrs
						\!\!\!\!\! & = & \!\!\!\!\!\!\! \sum_{k=j}^n \! {n \choose k} \! \big\{ k[F(x)]^{k-1} [1-F(x)]^{n-k}\! -\! (n-k) [F(x)]^k [1-F(x)]^{n-k-1}\! \big\}f(x)   \\
						\!\!\!\!\! & = & \!\!\!\!\!\!\! {n \choose j} j[F(x)]^{j-1} [1-F(x)]^{n-j}f(x)
						+ \!\! \! \sum_{l=j+1}^n {n \choose l} l[F(x)]^{l-1} [1-F(x)]^{n-l}f(x) \\
						\!\!\!\!\! &  & \!\!\!\!\! - \sum_{k=j}^{n-1} {n \choose k}(n- k)[F(x)]^{k} [1-F(x)]^{n-k-1}f(x) \\
						\!\!\!\!\! & = & \!\!\!\!\! \frac{n!}{(j-1)!(n-j)!} [F(x)]^{j-1} [1-F(x)]^{n-j}f(x) \\
						\!\!\!\!\! &  & \!\!\!\!\! + \sum_{k=j}^{n-1} {n \choose k+1} (k+1)[F(x)]^{k} [1-F(x)]^{n-k-1}f(x) \\
						\!\!\!\!\! &  & \!\!\!\!\! - \sum_{k=j}^{n-1} {n \choose k}(n- k)[F(x)]^{k} [1-F(x)]^{n-k-1}f(x)
						\eeqrs
						The result follows from the fact that the last two terms cancel, because \vspace{-3mm}
						\[ {n \choose k+1} (k+1) = \frac{n!}{k! (n-k-1)!} = {n \choose k} (n-k) \]
					\end{alertblock}}
					\frame{
						\begin{block}{Example 5.4.5.}
							Let $X_1,...,X_n$ be a random sample from $uniform(0,1)$ so that
							$f(x)=1$ and $F(x)=x$ for $x \in [0,1]$.
							
							By Theorem 5.4.4, the pdf of $X_{(j)}$ is \vspace{-2mm}{\small
								\[ \frac{n!}{(j-1)!(n-j)!} x^{j-1}(1-x)^{n-j} =
								\frac{\Gamma (n+1)}{\Gamma (j)\Gamma (n-j+1)} x^{j-1}(1-x)^{n-j+1-1} \quad \quad 0<x<1 \vspace{-2mm}\]}
							which is the pdf of $beta(j, n-j+1)$.
						\end{block}\vspace{-2mm}
						\begin{alertblock}{Theorem 5.4.6.}
							Let $X_{(1)},...,X_{(n)}$ be the order statistics of a random sample $X_1,...,X_n$ from a continuous population with cdf $F$ and pdf $f$.
							
							Then the joint pdf of
							$X_{(i)}$ and $X_{(j)}$, $1 \leq i < j \leq n$, is \vspace{-2mm}
							\beqrs
							f_{X_{(i)}, X_{(j)}}(x,y) &=& \frac{n!}{(i-1)!(j-i-1)! (n-j)!}  [F(x)]^{i-1}
							[F(y)-F(x)]^{j-i-1}\\
							&& \times [1-F(y)]^{n-j} f(x)f(y) \quad \quad \quad x <y ,  \ (x,y) \in {\cal R}^2
							\eeqrs
						\end{alertblock}\vspace{-2mm}
						\begin{alertblock}{}
							The proof is left to Exercise 5.26.
						\end{alertblock}
					}
					\frame{\vspace{-2mm}
						\begin{block}{Example 5.4.7.}
							Let $X_1,...,X_n$ be a random sample from $uniform(0,a)$, $R=X_{(n)}-X_{(1)}$ be the range, and $V= (X_{(1)}+X_{(n)})/2$ be the midrange.
							
							We want to obtain the joint pdf of $R$ and $V$ as well as the marginal distributions of $R$ and $V$.
							
							By Theorem 5.4.6, the joint pdf of $Z = X_{(1)}$ and $Y= X_{(n)}$ is \vspace{-2mm}
							\[ f_{Z,Y}(z,y) = \frac{n(n-1)}{a^2} \left( \frac{y}{a} - \frac{z}{a}\right)^{n-2}
							= \frac{n(n-1)(y-z)^{n-2}}{a^n} , \quad 0<z<y< a \vspace{-2mm} \]
							Since $R= Y-Z$ and $V= (Y+Z)/2$, we obtain $Z = V-R/2$ and $Y= V+R/2$, \vspace{-1mm}
							\[ \bigg| \frac{\partial (Z,Y)}{\partial (R,V)} \bigg| = \bigg| \br{rr}
							- \frac{1}{2} & 1 \vspace{1mm} \\
							\frac{1}{2} & 1 \er \bigg| = -1 \vspace{-1mm} \]
							The transformation from $(Z,Y)$ to $(R,V)$ maps the sets \vspace{-2mm}
							\[ \{ (z,y): 0 <z <y< a\} \rightarrow \{(r,v): 0<r<a, r/2<v < a-r/2\} \vspace{-2mm} \]
							Obviously $0<r<a$, and for a fixed $r$, the smallest value of $v$ is $r/2$ (when $z=0$ and $y=r$)
							and the largest value of $v$ is $a-r/2$ (when $z=a-r$ and $y=a$).
						\end{block}}
						\frame{\vspace{-2mm}
							\begin{block}{}
								Thus, the joint pdf of $R$ and $V$ is \vspace{-2mm}
								\[ f_{R,V}(r,v) = \frac{n(n-1)r^{n-2}}{a^n} , \quad \quad 0<r<a, \  r/2< v< a-r/2 \vspace{-2mm} \]
								The marginal pdf of $R$ is \vspace{-2mm}
								\[ f_R(r) = \int_{r/2}^{a-r/2} \frac{n(n-1)r^{n-2}}{a^n} dv = \frac{n(n-1)r^{n-2}(a-r)}{a^n} , \quad \quad 0<r<a \]
								The marginal pdf of $V$ is \vspace{-2mm}
								\beqrs
								f_V(v)  & = &
								\int_0^{2v} \frac{n(n-1)r^{n-2}}{a^n} dr = \frac{n(2v)^{n-1}}{a^n}  \quad \quad 0<v<a/2 \\
								& = & \int_0^{2(a-v)} \frac{n(n-1)r^{n-2}}{a^n} dr = \frac{n(2(a-v)^{n-1}}{a^n}  \quad \quad a/2 < v < a
								\eeqrs
								because the set where $f_{R,V} (r,v)>0$ is \vspace{-2mm}
								\beqrs
								&&  \{(r,v): 0<r<a, r/2<v < a-r/2\} \\
								& = & \{ (r,v): 0<v\leq a/2, 0<r < 2v \}\\
								& &  \bigcup \{ (r,v) : a/2 < v \leq a , 0<r < 2(a-v)\}
								\eeqrs
							\end{block}}
							\frame{\vspace{-2mm}
								\begin{alertblock}{Example.}
									Let $X_1,...,X_n$ be a random sample from $uniform(0,1)$.
									
									We want to find the distribution of $X_1/X_{(1)}$.
									
									For  $s > 1$, 
									\vspace{-2mm} 
									$$\begin{aligned}
									P\left(\frac{X_1}{X_{(1)}}>s\right)
									& =  \sum_{i=1}^n
									P\left(\frac{X_1}{X_{(1)}}>s , X_{(1)} = X_i \right)\\
									& =
									\sum_{i=2}^n
									P\left(\frac{X_1}{X_{(1)}}>s , X_{(1)} = X_i \right)\\
									& =
									(n-1)
									P\left(\frac{X_1}{X_{(1)}}>s, X_{(1)} = X_n \right)\\
									& =
									(n-1)
									P\left(X_1>s X_n , X_2 > X_n,...,X_{n-1}>X_n \right)\\
									& =
									(n-1)
									P\left(s X_n < 1, X_1>s X_n , X_2 > X_n,...,X_{n-1}>X_n \right)\\
									& =  (n-1)\int_0^{1/s} \left[ \int_{sx_n}^1 \left( 
									\prod_{i=2}^{n-1} \int_{x_n}^1  dx_i\right) dx_1 \right] dx_n  \\
									& =  (n-1) \int_0^{1/s} (1-x_n)^{n-2}(1-sx_n) dx_n  
									\end{aligned}$$
								\end{alertblock}}
								\frame{
									\begin{alertblock}{}
										Thus, for $s>1$, 
										$$\begin{aligned}
										\frac{d}{ds} P\left(\frac{X_1}{X_{(1)}} \leq  s\right)
										& = \frac{d}{ds} \left[ 1 -  (n-1) \int_0^{1/s} (1-t)^{n-2}(1-st) dt \right] \\
										& = (n-1) \int_0^{1/s} (1-t)^{n-2}t dt \\
										& = (n-1) \int_0^{1/s} (1-t)^{n-2}t dt - (n-1) \int_0^{1/s} (1-t)^{n-1} dt \\
										& = (n-1) \int_0^{1/s} (1-t)^{n-2}t dt - (n-1) \int_0^{1/s} (1-t)^{n-1} dt \\
										& = 1- \left(1-\frac{1}{s}\right)^{n-1} 
										- \frac{n-1}{n} \left[ 1- \left(1-\frac{1}{s}\right)^{n-1}\right] 
										\end{aligned}$$
										For $s \leq 1$, obviously \vspace{-1mm}
										\[ P\left( \frac{X_1}{X_{(1)}} \leq  s\right) = 0 \quad \quad 
										\frac{d}{ds} P\left( \frac{X_1}{X_{(1)}} \leq  s\right) =0  \]
									\end{alertblock}
								}

\end{document}


