% 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 Nine: Bayesian Statistics}}\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} \item \label{poissongamma} Let $X_1, \ldots, X_n$ be a random sample from a Poisson distribution with parameter $\lambda>0$. The prior on $\lambda$ is Gamma($\alpha,\beta$). This makes the prior expected value $\frac{\alpha}{\beta}$. \begin{enumerate} \item Give the posterior density of $\lambda$, including the constant that makes it integrate to one. % Gamma, alpha' = alpha+n*xbar, beta' = beta+n \item Derive the posterior predictive distribution -- actually, the posterior predictive probability mass function. Do you recognize it? \end{enumerate} \item Let $X_1, \ldots, X_n$ be random sample from a binomial distribution with parameters 4 and $\theta$, where $\theta$ is unknown. The prior distribution of $\theta$ is beta with parameters $\alpha$ and $\beta$. \begin{enumerate} \item Find the posterior density of $\theta$, including the constant that makes it integrate to one. % I get beta with alpha' = alpha + n*xbar and beta' = beta + n*(4-xbar) \item For $n=20$ observations and prior parameters $\alpha=\beta=1$ (the uniform distribution), we obtain $\overline{x}_n = 2.3$. \begin{enumerate} \item What is the posterior mean? The answer is a number. \item What is the posterior mode? The answer is a number. \item We need to know if the coin is biased. \begin{enumerate} \item What is $P\left(\Theta = \frac{1}{2}|\mathbf{x}\right)$? \item Using R, find $P\left(\Theta < \frac{1}{2}|\mathbf{x}\right)$ and $P\left(\Theta > \frac{1}{2}|\mathbf{x}\right)$. What do you conclude? \end{enumerate} \item Give a 95\% posterior credible interval for $\Theta$, with 2.5\% in each tail. \item How about a 95\% \emph{prior} credible interval? Is such a thing possible? \end{enumerate} \end{enumerate} \item Let $X_1, \ldots, X_n$ be a random sample from an exponential distribution with parameter $\lambda$. As in Question~\ref{poissongamma}, let the prior distribution of $\lambda$ be Gamma($\alpha,\beta$). \begin{enumerate} \item Find the posterior distribution. Show your work. The answer is one of the distributions on the formula sheet. Name the distribution and give formulas for its parameters. \item Derive a formula for the posterior mode --- that is, the value of $\lambda$ for which the posterior density is greatest. \item Imagine a universe in which there are true fixed parameter values, and suppose that the data really do come from an exponential distribution, with fixed true parameter $\lambda_0$. If we use the posterior expected value to estimate $\lambda_0$, is the estimator consistent? Answer Yes or No and show your work. \item What happens to the posterior variance as $n \rightarrow \infty$? Show your work. \item Is the posterior mode consistent? Answer Yes or No and show your work. \end{enumerate} \pagebreak \item Let $X_1, \ldots, X_n$ be random sample from a normal distribution with mean $\mu$ and precision $\tau$ (the precision is one over the variance). \begin{enumerate} \item Suppose that the parameter $\mu$ is known, while $\tau$ is unknown. The prior on $\tau$ is Gamma($\alpha,\beta$). Give the posterior distribution of $\tau$, including the parameters. \item Suppose that $\tau$ is known, while this time $\mu$ is unknown. The prior on $\mu$ is standard normal. Find the posterior distribution of $\mu$. \end{enumerate} \item Suppose the prior is a finite mixture of prior distributions. That is, the parameter $\theta$ has prior density \begin{displaymath} \pi(\theta) = \sum_{j=1}^k a_j \, \pi_j(\theta) \end{displaymath} The constants $a_1, \ldots, a_j$ are called \emph{mixing weights}; they are non-negative and they add up to one. Show that the posterior distribution is a mixture of the posterior distributions corresponding to $\pi_1(\theta), \ldots, \pi_k(\theta)$. What are the mixing weights of the posterior? This result can be useful if your model has a conjugate prior family, because you can represent virtually any prior opinion by a mixture of conjugate priors. For example, a bimodal prior might be just a mixture of two normals with different expected values. Thus, you can have essentially any prior you wish, and also the convenience of an exact posterior distribution. \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} % Deleteed because it requires plotting in R \item Let $\theta$ represent the probability that a particular type of cancer, apparently wiped out by chemotherapy, will recur within 2 years. Suppose you \emph{really have no prior idea} about the value of $\theta$. Therefore, you adopt a ``non-informative" uniform prior distribution on the interval from zero to one. Of course, if you have no idea about the probability, you also have no idea about the log odds. The log odds is given by $\ln\frac{\theta}{1-\theta}$. Derive the density of the log odds if $\theta$ has a uniform distribution, and use R to plot it. Do you seem to have an idea about what the log odds should be? % I get e^y/(1+e^y)^2, symmetric around zero. The moral of this story is that when you adopt a uniform prior, you are still expressing an opinion.