\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} % Good for US Letter paper \topmargin=-0.75in \textheight=9.5in \usepackage{fancyhdr} \renewcommand{\headrulewidth}{0pt} % Otherwise there's a rule under the header \setlength{\headheight}{15.2pt} \fancyhf{} \pagestyle{fancy} \cfoot{Page \thepage {} of 2} % % \pagestyle{empty} % No page numbers \begin{document} %\enlargethispage*{1000 pt} \begin{flushright} Name \underline{\hspace{60mm}} \\ $\,$ \\ Student Number \underline{\hspace{60mm}} \end{flushright} \vspace{2mm} \begin{center} {\Large \textbf{STA 312 f2023 Quiz 2}}\\ \vspace{1 mm} \end{center} \begin{enumerate} \item (5 points) Let $X_1, \ldots, X_n$ be a random sample from a geometric distribution; see formula sheet. Find the maximum likelihood estimate of $\theta$. Show your work and \textbf{circle your final answer}. \emph{You do not need to bother with the second derivative test.} \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item \label{comp} For Question 9 of Assignment 2, you analyzed numerical data from a distribution with density $f(x|\pi) = \pi e^{-\pi/x} \frac{1}{x^2}$ for $x>0$, where the parameter $\pi>0$. \begin{enumerate} \item (2 points) \label{mle} In the space below, write $\widehat{\pi}$, the maximum likelihood estimate of $\pi$. The answer is a number from your printout. On your printout, circle the number and write ``Question~\ref{mle}" beside it. \vspace{80mm} \item (3 points) \label{ci} You found a 95\% confidence interval for $\pi$. In the space below, write the lower and upper confidence limits. The answer is a pair of numbers from your printout. On your printout, circle the numbers and write ``Question~\ref{ci}" beside them. \end{enumerate} \end{enumerate}\vspace{80mm} \noindent Please attach the printout with your answers to Question~\ref{comp} of this quiz (Question 9 of the assignment). Make sure your name and student number are written on the printout. \end{document} # Assignment 2 # Simulating inverse gamma (one over exponential) data with lambda = 3. # Name of the file will be inversegamma.data.txt. rm(list=ls()); options(scipen=999) n = 300; lambda=3 set.seed(9999) x = 1/rexp(n,rate=lambda); x = round(x,2); x 6.56 1.47 7.92 4.35 1.54 6.23 4.71 0.73 1.74 5.66 2.25 1.28 4.44 1.98 3.00 12.79 2.37 2.92 1.40 3.22 13.71 4.28 1.28 6.29 17.05 24.18 0.94 2.91 9.08 3.13 57.68 12.75 57.86 1.03 0.82 12.71 8.67 46.58 11.07 5.28 4.28 8.40 1.26 3.33 1.46 14.98 7.65 1.22 26.03 14.91 1.04 21.10 3.30 3.25 3.81 1.97 4.71 4.56 2.63 14.60 4.72 15.42 2.98 0.66 2.20 11.10 14.92 1.46 2.37 11.00 325.18 1.99 0.78 1.26 2.74 4.29 3.60 2.16 3.98 1.68 7.03 2.46 2.97 1.65 3.07 585.02 3.65 11.13 2.36 26.05 1.51 1536.99 84.13 2.50 23.69 4.60 4.11 8.49 72.78 4.03 13.56 2.98 1.36 9.99 0.53 4.93 4.80 2.84 1.14 1.53 1.38 5.95 2.31 3.93 38.61 9.28 1.05 4.42 17.52 13.29 1.41 2.40 28.88 2.73 3.32 35.54 13.25 8.18 1.84 6.60 2.54 1.86 17.16 5.46 1.34 3.49 33.79 2.08 2.17 9.31 50.09 2.39 6.14 2.60 1.60 1.89 4.46 8.08 1.17 1.04 1.05 2.34 13.01 11.29 4.31 2.15 30.32 1.67 32.96 3.10 1.70 1.80 1.01 8.85 2.22 1.03 3.46 0.54 5096.32 3.09 14.56 11.13 36.13 10.05 4.02 2.66 25.56 12.38 8.55 10.19 5.29 1.57 8.66 8.94 2.43 19.45 16.15 0.94 239.27 2.96 4.84 4.52 11.99 1.26 2.52 2.78 1.72 2.43 1.74 8.89 1.37 1.63 6.26 2.55 3.83 3.76 1.58 2.86 1.38 8.38 215.87 27.51 3.47 1.73 3.89 1.70 31.09 9.19 11.51 1.04 1.27 0.42 3.68 13.26 16.91 6.01 4.18 22.11 4.58 4.31 14.92 8.70 4.89 1.11 7.27 0.93 4.84 5.36 15.09 0.73 1.63 2.14 145.46 1.00 3.09 103.53 2.40 2.54 17.21 2.08 14.38 1.44 1.81 5.19 7.28 29.13 2.40 6.65 12.05 6.71 3.54 1.44 2.87 1.44 1.39 20.34 0.77 5.65 0.83 1.77 9.61 4.74 26.91 1.97 3.85 1.77 1.42 1.84 22.22 8.02 5.13 144.21 2.55 3.94 2.45 1.92 2.41 1.14 7.47 1.20 59.21 2.18 25.70 1.34 3.08 0.95 7.15 5.96 2.32 3.96 x = scan("http://www.utstat.toronto.edu/~brunner/data/legal/inversegamma.data.txt") n = length(x) pihat = 1/mean(1/x); pihat se_pihat = sqrt(pihat^2/n); se_pihat Z = (pihat-3.14159)/se_pihat; Z pvalue = 2 * (1-pnorm(abs(Z))); pvalue > x = scan("http://www.utstat.toronto.edu/~brunner/data/legal/inversegamma.data.txt") Read 300 items > n = length(x) > pihat = 1/mean(1/x); pihat [1] 2.740541 > se_pihat = sqrt(pihat^2/n); se_pihat [1] 0.1582252 > Z = (pihat-3.14159)/se_pihat; Z [1] -2.534672 > pvalue = 2 * (1-pnorm(abs(Z))); pvalue [1] 0.01125527 > >