Skip to content

Commit 42e3142

Browse files
committed
who's that pokemon?
1 parent 2d100af commit 42e3142

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
\documentclass[a4paper,10pt, notitlepage]{report}
2+
\usepackage[utf8]{inputenc}
3+
\usepackage{natbib}
4+
\usepackage{amssymb}
5+
\usepackage{amsmath}
6+
\usepackage[shortlabels]{enumitem}
7+
8+
% Title Page
9+
\title{Extra assignment 0: Who's that (simulated) pokémon?}
10+
\author{Computational Statistics \\ Instructor: Luiz Max Carvalho}
11+
12+
\begin{document}
13+
\maketitle
14+
15+
\textbf{Hand-in date: 28/09/2022.}
16+
17+
\section*{General guidance}
18+
\begin{itemize}
19+
\item State and prove all non-trivial mathematical results necessary to substantiate your arguments;
20+
\item Do not forget to add appropriate scholarly references~\textit{at the end} of the document;
21+
\item Mathematical expressions also receive punctuation;
22+
\item Please hand in a single PDF file as your final main document.
23+
24+
Code appendices are welcome,~\textit{in addition} to the main PDF document.
25+
\end{itemize}
26+
27+
\section*{Background}
28+
29+
In this (hopefully) fun little exercise I will describe a rejection sampling algorithm to sample from a mysterious distribution.
30+
Suppose we have the following procedure:
31+
\begin{enumerate}
32+
\item Generate $U_1, U_2 \sim \operatorname{Uniform}(0, 1)$, independently;
33+
\item Compute $Y_1 = -\log(U1)$ and $Y_1 = -\log(U1)$.
34+
If $Y_2 > \frac{(1-Y_1)^2}{2}$, accept $Y = (Y_1, Y_2)$.
35+
Else, reject and return to step 1;
36+
\item Generate $U_3 \sim \operatorname{Uniform}(0, 1)$; if $U_3 < 1/2$, set $X = Y_1$, otherwise set $X = -Y_1$.
37+
\end{enumerate}
38+
39+
Your job is to analyse this algorithm mathematically, find out its target distribution and work out its acceptance rate.
40+
41+
\newpage
42+
43+
\section*{Questions}
44+
45+
\begin{enumerate}
46+
\item What is the distribution of $Y_1$ and $Y_2$?
47+
\item What is the distribution of the ``mystery'' random variate $X$?
48+
\item How can one take the output of the algorithm ($X$) and generate $W \sim \operatorname{Normal}(\mu, \sigma^2)$, with $\mu \in \mathbb{R}$ and $\sigma^2 \in \mathbb{R}_+$?
49+
\item Can you work out what the acceptance rate of this algorithm is?
50+
\item (bonus) Can you generalise this algorithm to sample from other distributions? For example, how would you modify the algorithm in order to sample from a Gamma distribution with parameters $a, b \in \mathbb{R}_+$?
51+
52+
\textbf{Hint:} consider modifying step 2) to accept when $Y_2 > f(Y_1)$ and choose $f$ carefully.
53+
\end{enumerate}
144 KB
Binary file not shown.

0 commit comments

Comments
 (0)