\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{fullpage} %\pagestyle{empty} % No page numbers \begin{document} %\enlargethispage*{1000 pt} \begin{center} {\Large \textbf{STA 312f23 Assignment Two}}\footnote{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: \href{http://www.utstat.toronto.edu/brunner/oldclass/312f23} {\texttt{http://www.utstat.toronto.edu/brunner/oldclass/312f23}}} \vspace{1 mm} \end{center} \noindent The paper and pencil questions are not to be handed in. They are practice for Quiz 2 on September 22nd. The R part of Question~\ref{inversegamma} may be handed in as part of the quiz. \textbf{Bring your printout to the quiz}. Do not write anything on your printout in advance except possibly your name and student number. \begin{enumerate} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Repeat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item This question is a repeat from Assignment One. If you have already done it, great! For each of the following distributions, derive a general expression for the Maximum Likelihood Estimator (MLE). Carry out the second derivative test to make sure you really have a maximum. Then use the data to calculate a numerical estimate. \begin{enumerate} \item $p(x)=\theta(1-\theta)^x$ for $x=0,1,\ldots$, where $0<\theta<1$. Data: \texttt{4, 0, 1, 0, 1, 3, 2, 16, 3, 0, 4, 3, 6, 16, 0, 0, 1, 1, 6, 10}. Answer: 0.2061856 % Geometric .25, thetahat = 1/(1+xbar) \item $f(x) = \frac{\alpha}{x^{\alpha+1}}$ for $x>1$, where $\alpha>0$. Data: \texttt{1.37, 2.89, 1.52, 1.77, 1.04, 2.71, 1.19, 1.13, 15.66, 1.43}. Answer: 1.469102 % Pareto alpha = 1 (one over uniform) alphahat = 1/mean(log(x)) \item \label{prec} $f(x) = \frac{\tau}{\sqrt{2\pi}} e^{-\frac{\tau^2 x^2}{2}}$, for $x$ real, where $\tau>0$. Data: \texttt{1.45, 0.47, -3.33, 0.82, -1.59, -0.37, -1.56, -0.20 }. Answer: 0.6451059 % Normal mean zero tauhat = sqrt(1/mean(x^2)) \item $f(x) = \frac{1}{\theta} e^{-x/\theta}$ for $x>0$, where $\theta>0$. Data: \texttt{0.28, 1.72, 0.08, 1.22, 1.86, 0.62, 2.44, 2.48, 2.96} Answer: 1.517778 % Exponential, true theta=2, thetahat = xbar \end{enumerate} % \item Each of the above, start with second derivative test, get SE. Especially for the first one (and maybe the last), the formula does not simplify nicely. % \item Normal random sample, numerical n = 50 or so, CI all with R. What is diff from usual CI for mu? For sigmasquared? This is a good problem. \item For Problem \ref{prec}, \begin{enumerate} \item Use your work on the second derivative teat to produce a formula for the estimated asymptotic variance of the MLE. You will have the posted formula sheet for Quiz~2. \item Give a numerical standard error for the MLE. \end{enumerate} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% More Review. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item Let $X$ have a Bernoulli distribution with parameter $\theta$. Verify the formulas for expected value and variance on the formula sheet. \item Let $X$ have an exponential distribution with parameter $\lambda$. Verify the formulas for expected value and variance on the formula sheet. To save some work, you may use the fact that all the densities on the formula sheet integrate to one. \item Let $X \sim N(\mu,\sigma^2)$. Show $Z=\frac{X-\mu}{\sigma} \sim N(0,1)$. \item Prove that if $Z \sim N(0,1)$, then $Z^2 \sim \chi^2(1)$. You may use the fact that a $\chi^2(\nu)$ random variable is gamma, with $\alpha=\frac{\nu}{2}$ and $\beta=\frac{1}{2}$. % For chatGPT: Show that the square of a standard normal random variable is chi-squared, with df=1. Please produce your answer as a complete LaTeX document, documentclass{article}. \pagebreak \item Let $X_1, \ldots, X_n$ be a random sample (that is, independent and identically distributed) from a distribution with expected value $\mu$ and variance $\sigma^2$. The sample mean is $\overline{X}_n = \frac{1}{n}\sum_{i=1}^n X_i$. \begin{enumerate} \item Calculate $E(\overline{X}_n)$. Show your work. \item Calculate $Var(\overline{X}_n)$. Show your work. \end{enumerate} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item Let $X_1, \ldots, X_n$ be a random sample (that is, independent and identically distributed) from a Poisson distribution with parameter $\lambda>0$. The sample mean for a sample of $n=49$ is $\overline{X} = 4.2$. \begin{enumerate} \item Derive a formula for $\widehat{\lambda}$, the maximum likelihood estimate of $\lambda$. \item Carry out the second derivative test. \item Give a point estimate of $\lambda$. Your answer is a number. \item Give a 95\% confidence interval for $\lambda$; the answer is a pair of numbers. My lower confidence limit is 3.63. Note that in this problem you do \emph{not} need to go through the Fisher information to get the standard error, because you can just write down the exact variance of $\widehat{\lambda}$. % \vspace{50mm} \item Carry out a two-sided $Z$-test of $H_0:\lambda=3$ at $\alpha=0.05$. \begin{enumerate} \item What is the critical value? The answer is a number You can use R, or just look it up on the lecture slides. \item Calculate the test statistic. The answer is a number. I did it two ways and got $Z=4.1$ and $Z=4.85$. The method yielding 4.1 is more similar to what we will be doing later in the course. \item Do you reject the null hypothesis? Answer Yes or No. \item Do you conclude that $\lambda$ is different from 3? Answer Yes or No. \item If the answer to the last question was Yes, do you conclude that $\lambda$ is less than 3, or that $\lambda$ is greater than 3? Pick one. \item Use R to calculate the two-sided $p$-value for $Z=4.1$. My answer is 4.131501e-05 = 0.00004131501. \end{enumerate} \end{enumerate} \pagebreak \item \label{inversegamma} Let $X_1, \ldots, X_n$ be a random sample from a distribution with density $f(x|\pi) = \pi e^{-\pi/x} \frac{1}{x^2}$ for $x>0$, and zero for $x \leq 0$. The unknown parameter $\pi$ is greater than zero. \begin{enumerate} \item Verify that this really is a density by showing that it integrates to one. To save some work, you may use the fact that all the densities on the formula sheet integrate to one. \item \label{mle} Derive a formula for the MLE of $\pi$. Include the second derivative test. Show your work and circle your final answer. \item \label{vhat} Give a formula for $\widehat{v}_n$, the estimated asymptotic variance of $\widehat{\pi}_n$. Show a little work. \item The file \href{http://www.utstat.toronto.edu/brunner/data/legal/inversegamma.data.txt} {\small\texttt{http://www.utstat.toronto.edu/brunner/data/legal/inversegamma.data.txt}} has a set of raw data. Using R and your answers to Questions~\ref{mle} and~\ref{vhat}, calculate \begin{enumerate} \item The maximum likelihood estimate $\widehat{\pi}_n$. \item A 95\% confidence interval for $\pi$. \end{enumerate} The answers are numbers on your printout. \item Test $H_0: \pi = 3.14159$ with a two-sided large-sample $Z$-test, using the $\alpha=0.05$ significance level. \begin{enumerate} \item There are two critical values, one for the lower tail and one for the upper tail. What are they? The answers are numbers. \item What is the value of the test statistic? The answer is a number on your printout. \item Use R to calculate the 2-sided $p$-value. The answer is a number on your printout. My answer is \texttt{0.01125527}. \item Do you reject the null hypothesis? Answer Yes or No. \item Are the results statistically significant? Answer Yes or No. \item Do these data contradict claim that $\pi = 3.14159$? Answer Yes or No. \end{enumerate} \end{enumerate} \vspace{20mm} \end{enumerate} % End of all the questions \noindent \textbf{Bring your printout from Question~\ref{inversegamma} to the quiz.} Do not write anything on your printout in advance except possibly your name and student number. \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % See work and quiz files for R work.