\documentclass[dvipsnames, pdflatex,slidecentered]{beamer} %add red inside []
\usepackage{xcolor,colortbl}
\usepackage{amsmath,epsfig,latexsym}
\usepackage{hyperref}

%  options  [handout]

%  There is a VERY rich set of possible
%  styles of presentations and color themes.  See the
%  beamer documentation for a full list of possibilities.
\usetheme{default}  % JuanLesPins  Rochester
                   %  Berkeley  Palo Alto    with sidebar and top
                   % Goettingen  Marburg     with sidebar
                   %  Copenhagen  Luebeck  Warsaw
                   % Antibes with overlays
\useinnertheme{rounded}
\usecolortheme{rose} %crane %lily
%\usefonttheme{structuresmallcapsserif}


\usepackage{pgfarrows}
%  Don't need to load the pgf package, but it has
%  has itself some packages you might want, such as
%  pgfarrows,,pgfnodes,pgfautomata,pgfheaps
%  See the pgf documentation.


\usepackage{amsmath,amssymb}

% \beamertemplatetransparentcovereddynamic
                % overlays that are upcoming are transparent, in
                % a manner that depends upon how far ahead  they are.



%\usepackage{SweaveSlides}
\title[Stat 849'F07]{Stat 849: Application of the Gauss-Markov Theorem}
\author[S. Kele\c{s}]{S\"und\"uz Kele\c{s}}
\institute[UW]{Department of Statistics\\
 Department of Biostatistics and Medical Informatics\\
University of Wisconsin, Madison}
\date[]{\today}


%\mode<presentation>
%{ \usetheme{boxes} }



\begin{document}

\frame{\titlepage}

\begin{frame}
\frametitle{Problem}


A rocket is launched from ground level (altitude $y=0$) at time
$t=0$. Its upward acceleration is $a$. The altitude of the rocket is
measured by two separate instruments at times $t_1, t_2, \cdots,
t_n$. At time $t_i$, the altitudes $y_{i,1}$ and $y_{i,2}$ measured
by the respective instruments satisfy the model
\[y_{i,j}=\frac{1}{2}at_i^2+e_{i,j}, \quad 1 \le i \le n \quad j=1,2.\]
The measurement errors $\{e_{i,j}:1 \le i \le n, j=1,2\}$ are taken
to be independent, identically distributed. Both the acceleration
$a$ and the variance $\sigma^2$ are unknown.

\end{frame}

\begin{frame}
\frametitle{Candidate estimators for $a$}
\begin{itemize}

\item \textcolor{red}{Least squares estimator:}
\[\hat{a}_{LSE} =
\frac{\sum_{i=1}^nt_i^2(y_{i,1}+y_{i,2})}{\sum_{i=1}^n t_i^4}.\]

\item \textcolor{red}{Another estimator:}
\[\tilde{a}=\sum_{i=1}^n(y_{i,1}+y_{i,2})/\sum_{i=1}^nt_i^2.\]

\end{itemize}

You are allowed to choose between the two estimators. Which one
would you use and why?
\end{frame}

\begin{frame}
\frametitle{Properties of the estimators}

\begin{itemize}
\item <+-> Linearity?  \pause Both estimators are linear.

\item <+-> Bias: \pause

$\hat{a}_{LSE}$ is unbiased by the LSE theory.

\pause
\begin{eqnarray*}
E[\tilde{a}] = \frac{\sum_{i=1}^n E(y_{i,1} + y_{i,2})}{\sum_{i=1}^n
t_i^2} &=& \frac{\sum_{i=1}^n (at_i^2/2 +
at_i^2/2)}{\sum_{i=1}^nt_i^2}\\
& =& a\frac{\sum_{i=1}^nt_i^2}{\sum_{i=1}^nt_i^2} = a.
\end{eqnarray*}

\item <+-> \pause Both are linear and biased. By the Gauss-Markov Theorem,
the LSE $\hat{a}_{LSE}$ is better (has smaller mean squared error,
e.g., variance).
\end{itemize}
\end{frame}


\begin{frame}
\frametitle{Variances of the estimators}
\begin{eqnarray*}
Var(\hat{a}_{LSE}) &=& \frac{2\sigma^2}{\sum_{i=1}^n t_i^4}, \\
Var(\tilde{a}) & = & \frac{2n\sigma^2}{ \left (\sum_{i=1}^nt_i^2
\right)^2}.
\end{eqnarray*}

\pause  Can estimate these variances by replacing $\sigma^2$ by its
least squares estimator $s^2$.
\end{frame}


\begin{frame}
\frametitle{A simulation study to see this in action} We will
generate $1000$ data points. Then, we will look at the variance and
bias of the two estimators as a function of the sample size ($n =
\{10, 20, \cdots, 1000\}$).
\end{frame}

\begin{frame}
\frametitle{Results: Bias}
\begin{figure}
\begin{center}
\includegraphics[angle=0,scale=0.5]{GM_bias}
\end{center}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Results: Variance}
\begin{figure}
\begin{center}
\includegraphics[angle=0,scale=0.5]{GM_var}
\end{center}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Notes on the \texttt{R} code}

\begin{itemize}

\item The code to generate these plots are available on the course
website.

\item The code works with the estimator of $2a$ rather
than $a$.

\item $Var(2\tilde{a}) = 4 Var(\tilde{a})$.

\item Note that for each $t_i^2$ we have a $y_{i, 1}$ and $y_{i,2}$, $i=1, \cdots, n$.
So the effective sample sized of the data is $2n$.

\item You are encouraged to experiment with the value of $a$,
$\sigma^2$, and sample size.
\end{itemize}

\end{frame}


\begin{frame}
\frametitle{Exercise}

\begin{itemize}
\item Calculate variances of the both estimators.

\item Analytically show that $\hat{a}_{LSE}$ has a smaller variance (\textit{Hint:} Use Cauchy-Schwarz inequality).

\end{itemize}
\end{frame}


\end{document}
