\documentclass[xcolor=table,t,]{beamer}
%\usepackage{logictheme}
%\usepackage{palatino}

\usetheme{umbc1}

\useoutertheme{umbcfootline} 
%\author{Sept 21, 2010} 
%\title{~} 
%\institute{~}

\setfootline{STA 3000F: Nov 29, 2013
    \hfill \insertframenumber/\inserttotalframenumber} 
    
\usepackage{times}
\usefonttheme{structurebold}

\usepackage{colortbl}
\usepackage[english]{babel}
%\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps}
\usepackage{amsmath,amssymb}
\usepackage[latin1]{inputenc}
\usepackage{colortbl}

\usepackage{epstopdf}

\def\dotsim{\stackrel{.}{\sim}}
\def\goesd{\stackrel{d}{\rightarrow}}
\def\vp{{\varphi}}
\def\blue{\color{blue}}
\def\gray{\color{gray}}

\setbeamercovered{dynamic}

%\includeonlyframes{current1, current2, current3 }
%\setbeamertemplate{footline}[frame number]
\setbeamertemplate{items}[triangle] % delete this line to get bullets

\usepackage{graphicx}
\usepackage{epstopdf} 
\usepackage{pdfpages}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `basename #1 .tif`.png} 



\begin{document}

\begin{frame}{Lehmann \& Romano, TSH Ch.~3}
\begin{itemize}[<+->]
\item {\blue Setup}: define a test function $\phi(y)$ from ${\cal Y}$ to $[0,1]$
\item $\phi(Y) = \text{Pr}(Y \in {\cal R})$
\item if $\phi(y) = 1$ then $y \in {\cal R}$, if $0$, $y \notin {\cal R}$
\item {\gray allows for the possibility of randomized tests}
\\~\\
\item if $Y \sim f(y;\theta)$, then
\item $\text{E}_\theta\phi(Y) = \int \phi(y)f(y;\theta)dy$ = probability of rejection
\item under $H_0:\theta\in\Theta_0$, this is the  size of the test, or type I error
\item under $H_1:\theta\in\Theta_1$, this is the power of the test \\~\\
\item {\blue Goal}: maximize $$\beta_\phi(\theta) = \text{E}_\theta\phi(Y) \quad \forall \theta\in\Theta_1,$$
subject to $$\text{E}_\theta\phi(Y) \le \alpha, \quad \forall \theta\in\Theta_0$$
\end{itemize}
\end{frame}

\begin{frame}{Neyman-Pearson lemma}
\begin{itemize}[<+->]
\item Suppose $\Theta_0$ is the point $\theta_0$, and similarly for $\Theta_1$
\item Assume the existence of densities $f_0$ and $f_1$ with respect to the same measure $\mu$
\end{itemize} \pause
 %\begin{theorem}
\begin{enumerate}\item Given $0 \le \alpha \le 1$, there exists a test function $\phi$ and a constant $k$ such that
\begin{equation}\label{size}
\text{E}_0\phi(Y) = \alpha\end{equation} and
\begin{equation}\label{mptest}
\phi(y) = \left\{\begin{array}{ccc} 1 & \text{when} & f_1(y) > kf_0(y),\\
0 & \text{when} & f_1(y) < k f_0(y).\end{array}\right.
\end{equation}
\item If a test satisfies (\ref{size}) and (\ref{mptest}) for some $k$, then it is most powerful for testing $f_0$ against $f_1$ at level $\alpha$
\item If $\phi$ is most powerful at level $\alpha$ for testing $f_0$ against $f_1$, then for some $k$ it satisfies (\ref{mptest}), a.e. $\mu$, and satisfies (\ref{size}) unless there exists a test of size $<\alpha$ and with power $1$.
\end{enumerate}
%\end{theorem}

%\end{itemize}
\end{frame}
\begin{frame}{Proof 1.}
\begin{itemize}[<+->]
\item trivial for $\alpha = 0$ and $\alpha = 1$ {\gray allow $k = \infty$}
\item {\blue 1.} define $\alpha(c) = \text{Pr}_0\{f_1(Y) > cf_0(Y)\} = \text{Pr}\{f_1(Y)/f)0(Y)>c\}$. 
\item $1-\alpha(c)$ is a cumulative distribution function
\item so $\alpha(c)$ is non-increasing, right-continuous, $\alpha(-\infty) = 1, \alpha(\infty) =0$ \\~\\
\item Given $0 < \alpha < 1$, let $c_0$ be such that $\alpha(c_0)\le\alpha\le\alpha(c_0^-)$
\item $$\phi(y) = \left\{\begin{array}{ccc}
1 & \text{when} & f_1(y)>c_0f_0(y) \\
 \frac{\alpha-\alpha(c_0)}{\alpha(c_0^-) -\alpha(c_0)}&\text{when} & f_1(y) = c_0f_0(y)\\
 0 & \text{when} & f_1(y)< c_0f_0(y)
 \end{array}\right.
 $$
 \item $$
 \text{E}_0\phi(Y) = \text{Pr}_0
 \left\{\frac{f_1(Y)}{f_0(Y)}\right\}+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 $$
\end{itemize}
\end{frame}
\begin{frame}{... proof 2.}
\begin{itemize}[<+->]
\item Suppose $\phi$ is a test satisfying (\ref{size}) and (\ref{mptest}), and that $\phi^*$ is another test with $\text{E}_0\phi^*(Y)\le\alpha$.  
\item Denote by $S^+$ and $S^-$ the sets in ${\cal Y}$ where $\phi(y)-\phi^*(y)>0$ and $<0$. 
\item In $S^+$, $\phi(y)>0$ so $f_1(y)\ge kf_0(y)$, and  
\item $$
\int(\phi-\phi^*)(f_1-kf_0)d\mu = \int _{S^+\cup S^-}(\phi-\phi^*)(f_1-kf_0)d\mu\ge 0$$
\item difference in power:$$\int(\phi-\phi^*)f_1d\mu \ge k\int(\phi-\phi^*)f_0d\mu \ge 0$$
\end{itemize}
\end{frame}
\begin{frame}{... proof 3.}
\begin{itemize}[<+->]
\item Let $\phi^*$ be MP level $\alpha$, and $\phi$ satisfy (\ref{size}) and (\ref{mptest})
\item On $S^+ \cup S^-$, $\phi$ and $\phi^*$ differ. Let $S = S^+ \cup S^- \cap \{y: f_1(y)\ne kf_0(y)\}$, and assume $\mu(S)>0$
\item $$\int_{S^+\cup S^-}(\phi-\phi^*)(f_1-kf_0)d\mu = \int_S (\phi-\phi^*)(f_1-kf_0)d\mu > 0$$
\item implies $\phi$ is more powerful than $\phi^*$ 
\item contradiction, hence $\mu(S) = 0$\\~\\
\item {\gray if $\phi^*$ had size $<\alpha$ and power $<1$, could add points to rejection region until either $\text{E}_0\phi^*(Y) = \alpha$ or $\text{E}_1\phi^*(Y)=1$}
\\~\\
\item {\gray test is unique if $\{y: f_1(y)=kf_0(y)\}$ has measure $0$}
\end{itemize}
\end{frame}
\begin{frame}{Comments}
\begin{itemize}[<+->]
\item discreteness: e.g. $Y \sim \text{Bin}(n,p)$ 
\item MP test has rejection region ${\cal R}$ determined by $\{y > d_\alpha\}$
\item not all values of $\alpha$ attainable: e.g. CH Example 4.9 $Y \sim \text{Poisson}(\mu)$
\item $H_0: \mu=1, \quad H_1:\mu=\mu_1>1$, MP test $Y \ge d_\alpha$
{\footnotesize \onslide<5->\begin{table}\caption{attained significance levels}
\begin{tabular}{llll}
$y$ & $\text{Pr}(Y > y; \mu=1)$ & $y$ & $\text{Pr}(Y > y; \mu=1)$\\ \hline
0 & 1 & 4 & 0.0189 \\
1 & 0.632 & 5 & 0.0037 \\
2 & 0.264 & 6 & 0.0006 \\
3 & 0.080 & $\vdots$ & $\vdots$
\end{tabular}\end{table}}
\item if critical regions are {\em nested}, i.e. ${\cal R}_{\alpha_1} \subset {\cal R}_{\alpha_2}, \alpha_1 < \alpha_2$, then \\
 $p_{obs} = \inf(\alpha; y_{obs} \in {\cal R}_\alpha)$
\item asymmetry: $Y \sim N(\mu, 1), H_0:\mu=0, H_1:\mu=10, \quad y_{obs} = 3$
\end{itemize}
\end{frame}

\begin{frame}{Bayesian testing}\hfill{\gray see CH Example 10.12}
\begin{itemize}[<+->]
\item simple $H_0$, simple $H_1$: $$\frac{\text{Pr}(H_0\mid y)}{\text{Pr}(H_1\mid y)} = \frac{\text{Pr}(H_0)}{\text{Pr}(H_1)}\frac{f_0(y)}{f_1(y)}$$
\item similarly, with $H_1, \dots H_k$ potential alternatives
$$
\frac{\text{Pr}(H_0\mid y)}{\text{Pr}(H_0^c\mid y)} = \frac{\text{Pr}(H_0)f_0(y)}{\Sigma_j \text{Pr}(H_j)f_j(y)}$$ \\~\\
\item sharp null hypothesis: $H_0: \theta = \theta_0, \quad H_1:\theta\ne\theta_0$
$$
\frac{\text{Pr}(H_0\mid y)}{\text{Pr}(H_0^c\mid y)}= \frac{\pi_0}{(1-\pi_0)}\frac{f(y;\theta_0)}{\int \pi_1(\theta)f(y;\theta)d\theta}
$$
\item nuisance parameters
$$
\frac{\text{Pr}(H_0\mid y)}{\text{Pr}(H_0^c\mid y)}= \frac{\pi_0}{(1-\pi_0)}\frac{\pi(\lambda\mid h_0)f(y\mid \psi_0, \lambda)d\lambda}{\int \int \pi(\psi,\lambda\mid H_1)f(y\mid \psi,\lambda)d\psi d\lambda}
$$
\end{itemize}
\end{frame}
\begin{frame}{... testing}
\begin{itemize}[<+->]
\item Bayes factor $B_{10} = \displaystyle{\frac{\text{Pr}(y\mid H_1)}{\text{Pr}(y\mid H_0)}}$\\~\\
\item typically $\text{Pr}(y\mid h_i) = \int f(y\mid H_i,\theta_i)\pi(\theta_i\mid H_i)d\theta_i, \quad i = 0, 1$
\end{itemize}
\includegraphics[scale=0.4]{SM11-3.jpg}
\hfill{SM Ch.~11.2}
\begin{itemize}
\item \onslide<5->{cannot be computed with improper priors}\end{itemize}
\end{frame}
%\end{document}
\begin{frame}{Nature, PNAS, AoS articles by Johnson}
\begin{itemize}[<+->]
\item developed an `objective' Bayesian test for comparison to $p$-values
\item ``A $p$-value of 0.05 or less corresponds to Bayes factors of between 3 and 5, which are consider weak evidence to support a finding''
\item ``He advocates for scientists to use more stringent $p$-values of 0.005 or less'' \\~\\
\item see also CH Example 10.12 and SM Example 11.15 \\~\\
\item emphasis on point hypotheses drives most of these anomalous results
\item e.g. $\text{Pr}(\theta > 0 \mid y)$ 
\end{itemize}
\end{frame}
\end{document} 