% 260s20Assignment.tex     Likelihood Ratio Tests
\documentclass[12pt]{article} 
%\usepackage{amsbsy} % for \boldsymbol and \pmb 
%\usepackage{graphicx} % To include pdf files!
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amsfonts}
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref} % For links
\usepackage{comment}
%\usepackage{fullpage}
\oddsidemargin=0in                  % Good for US Letter paper
\evensidemargin=0in
\textwidth=6.3in
\topmargin=-1in
\headheight=0.2in
\headsep=0.5in
\textheight=9.4in

%\pagestyle{empty} % No page numbers

\begin{document}
%\enlargethispage*{1000 pt} 

\begin{center}   
{\Large \textbf{STA 260s20 Assignment Ten: More Estimation}}\footnote{Copyright information is at the end of the last page.}
%\vspace{1 mm}
\end{center}

\noindent
The following homework problems are not to be handed in.  They are preparation for the final exam. \textbf{Please try each question before looking at the solution}. Use the formula sheet.

\begin{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Sufficiency %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2006A6

    \item Let $X_1, \ldots, X_n$ be a random sample from a Bernoulli distribution with parameter $\theta$. 
        \begin{enumerate}
            \item Give a one-dimensional sufficient statistic for $\theta$. Show your work and circle your answer. 
            \item Calculate your sufficient statistic for the following set of data: 
            1 0 1 0 0. 
            Your answer is a single number; circle it. My answer is 2, but yours may be different and still correct, if you arrived at another sufficient statistic. 
        \end{enumerate}

    \item Let $X_1, \ldots, X_n$ be a random sample from a Poisson distribution with parameter $\lambda$. 
        \begin{enumerate}
            \item Give a one-dimensional sufficient statistic for $\lambda$. In addition to being sufficient, your answer must also be an unbiased estimator. Show your work and circle your answer. You do not need to prove that your estimator is unbiased.
            \item Calculate your sufficient statistic for the following set of data: 
            14 10  8  8. 
            Your answer is a single number; circle it. My answer is 10. 
        \end{enumerate}

    \item Let $X_1, \ldots, X_n$ be a random sample from a Gamma distribution with parameters $\alpha=\theta$ and $\lambda=\frac{1}{2}$. 
        \begin{enumerate}
            \item Give a one-dimensional sufficient statistic for $\theta$. 
            \item Calculate your sufficient statistic for the following set of data: 
            0.706 2.154 2.367 4.039 2.155 1.678. 
            Your answer is a single number; circle it. My answer is 52.57288, but yours may be different and still correct, if you arrived at another sufficient statistic.
         \end{enumerate}

    \item Let $X_1, \ldots, X_n$ be a random sample from a uniform distribution with parameters $L$ and $R$.
        \begin{enumerate}
            \item Give a two-dimensional sufficient statistic for $(L,R)$. Show your work and circle your answer. 
            \item Calculate your sufficient statistic for the following set of data: 
            5.103 6.400 5.415 4.198 4.817 5.907. 
            Your answer is a pair of numbers; circle them. My answer is (4.198, 6.4), but yours may be different and still correct, if you arrived at another sufficient statistic. 
        \end{enumerate}
 
 \pagebreak
 
    \item Let $X_1, \ldots, X_n$ be a random sample from a normal distribution with parameters $\mu$ and $\sigma^2$.
        \begin{enumerate}
            \item Give a two-dimensional sufficient statistic for $(\mu,\sigma^2)$. In addition to being sufficient, your statistics must also be unbiased estimators. Show your work and circle your answer. You do not need to prove that your estimators are unbiased.
            \item Calculate your sufficient statistic for the following set of data: 
            100.3 100.6  96.5  99.3 104.1. 
            Your answer is a pair of numbers; circle them. My answer is (100.16, 7.468). 
        \end{enumerate}

    \item Let $X_1, \ldots, X_n$ be a random sample from a distribution with density
        \begin{displaymath}
            f(x|\theta,\delta) = \frac{1}{\theta}      
                                e^{-\frac{x-\delta}{\theta}}I(x\geq\delta),
        \end{displaymath}
        where $\theta>0$ and $\delta$ is any real number. 
        \begin{enumerate}
            \item Give a two-dimensional sufficient statistic for $(\theta,\delta)$. Show your work and circle your answer. 
            \item Calculate your sufficient statistic for the following set of data: 
            11.03 10.34 11.26 10.02 10.42 10.58. 
            Your answer is a pair of numbers; circle them. My answer is (63.65, 10.02), but yours may be different and still correct, if you arrived at another sufficient statistic. 
        \end{enumerate}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \item Let $X_1, \ldots, X_n$ be a random sample from a discrete distribution with probability mass function $p(x|\theta)$. Show that $E(\ell^\prime(\theta,\mathbf{X})) = 0$. Assume that $\frac{\partial}{\partial\theta}$ can be passed through summation signs with respect to $x$; this is a ``regularity condition". Start with 
$E\left(\frac{\partial}{\partial\theta} \ln p(X_i|\theta) \right)$. 

    \item Let $X_1, \ldots, X_n$ be a random sample from a Bernoulli distribution with parameter $\theta$. 
                \begin{enumerate}
                    \item Suggest a reasonable estimator of $\theta$; call it $\widehat{\Theta}_n$. Is $\widehat{\Theta}_n$ an unbiased estimator of $\theta$? Just answer Yes or No.
                    \item What is $Var(\widehat{\Theta}_n)$? Show a little work this time.
            \item Find the Cram\'er-Rao lower bound on the variance for this problem.
            \item Comparing the variance of $\widehat{\Theta}_n$ to the Cram\'er-Rao lower bound, is $\widehat{\Theta}_n$ a Minimum Variance Unbiased Estimator? Answer Yes or No.
                \end{enumerate}


\pagebreak

    \item \label{centered} Let $X_1, \ldots, X_n$ be a random sample from a normal distribution with $\mu=0$ and unknown variance $\theta>0$. Consider the Method of Moments estimator $\widehat{\Theta} = \frac{1}{n}\sum_{i=1}^nX_i^2$. 
                \begin{enumerate}
                    \item Is $\widehat{\Theta}_n$ an unbiased estimator? Show your work and answer Yes or No.
                    \item What is $Var(\widehat{\Theta}_n)$? Hint: What is the distribution of $\frac{1}{\theta}\sum_{i=1}^nX_i^2$?
            \item Find the Cram\'er-Rao lower bound on the variance for this problem.
            \item Comparing the variance of $\widehat{\Theta}_n$ to the Cram\'er-Rao lower bound, is $\widehat{\Theta}_n$ a Minimum Variance Unbiased Estimator?
                \end{enumerate}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLT for MLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


    \item Let $X_1, \ldots, X_n$ be a random sample from a Geometric distribution with parameter $\theta$. 
        \begin{enumerate}
            \item Derive the maximum likelihood estimate of $\theta$. Show your work. The answer is a formula. Don't bother with the second derivative test.
            \item A sample of size $n=100$ yields $\overline{x}_n = 0.85$. Give the MLE and a 95\% confidence interval for $\theta$. The MLE is a number, and the confidence interval is a pair of numbers, a lower confidence limit and an upper confidence limit. Use the Central Limit Theorem for MLEs.
        \end{enumerate}
    
    \item As in Question~\ref{centered}, suppose we have data from a normal distribution with mean zero and variance $\theta$. A random sample of size $n=120$ yields $\sum_{i=1}^n x_i^2 = 480.38$. Please obtain a 95\% confidence interval for $\theta$ in two ways.
        \begin{enumerate}
            \item Using the Central Limit Theorem for MLEs. This gives you an \emph{approximate} 95\% confidence interval. 
            \item Using the chi-squared distribution. This yields an \emph{exact} confidence interval.
        \end{enumerate}
The two intervals should be fairly close. 
\begin{comment}
rm(list=ls()); set.seed(9999)
x= rnorm(120,0,2) # SD=2 so the true variance is theta = 4.
round(sum(x^2),2) # 480.38
mean(x^2) # thetahat = 4.003183
480.38/120 # 4.003167
# a) Large-sample
me = 1.96*sqrt(2)*4.003/sqrt(120); me # 1.013
c(4.003-1.013, 4.003+1.013) # (2.990, 5.016)
# b) Exact chi-squared
cv.025 = qchisq(0.025,120); cv.025  # 91.57
cv.975 = qchisq(0.975,120); cv.975  # 152.21
L = sum(x^2)/cv.975; U = sum(x^2)/cv.025
c(L,U) # 3.156018 5.245912
round(c(480.38/152.21, 480.38/91.57) , 2) # (3.16, 5.25)
\end{comment}


\item Since the model of Question \ref{centered} is so appealing, consider these two test statistics for testing $H_0: \theta \leq \theta_0$ versus $H_1: \theta > \theta_0$.
\begin{center}
\begin{tabular}{clcl}
(a) & $Y =  \frac{1}{\theta_0} \sum_{i=1}^n X_i^2$ & \hspace{2mm} & Reject when $Y \geq \chi^2_{1-\alpha}(n)$ \\
&&\\
(b) & $Z_n = \frac{\sqrt{n}(\widehat{\Theta}_n-\theta)} {\sqrt{1/I(\theta_0)}}$ 
& \hspace{2mm} & Reject when $Z_n \geq z_{1-\alpha}$
\end{tabular}
\end{center}
Find the power of each test for $H_0: \theta \leq 4$ and $n=120$ when the true value of $\theta$ is 4.25. For each test, show your work and use R to obtain the power, a number between zero and one. Include the R command in your answer; it's very short, like \texttt{pnorm(}something\texttt{)}. 


\end{enumerate} % End of all the questions

 % \vspace{80mm}

\vspace{3mm}
\hrule %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{3mm}

\noindent
This assignment was prepared by  \href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner},
Department of Mathematical and Computational Sciences, University of Toronto. It is licensed under a 
\href{http://creativecommons.org/licenses/by-sa/3.0/deed.en_US}
     {Creative Commons Attribution - ShareAlike 3.0 Unported License}. Use any part of it as you like and share the result freely. The \LaTeX~source code is available from the course website: 
     
\begin{center}
\href{http://www.utstat.toronto.edu/~brunner/oldclass/260s20} {\small\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/260s20}}
\end{center}

\end{document}



