section (Introduction) : Diffusions Arise in Various Application Areas. They Are

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{geometry, amsmath}
\numberwithin{equation}{section}
\usepackage{amsfonts, amssymb}
\usepackage{enumitem}
\usepackage{algorithm}
\usepackage{mathtools}
\usepackage{etoolbox}
\usepackage{pseudocode}
\usepackage[noend]{algpseudocode}
\usepackage[square]{natbib}
\usepackage[section]{placeins}
\usepackage{tcolorbox}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\usepackage{theorem}
\usepackage{hyperref}
\mdfdefinestyle{MyFrame}{%
linecolor=blue,
outerlinewidth=2pt,
roundcorner=20pt,
innertopmargin=\baselineskip,
innerbottommargin=\baselineskip,
innerrightmargin=20pt,
innerleftmargin=20pt,
backgroundcolor=gray!50!white}
\title{\textbf{18-Months Upgrade Report}}
\author{Divakar Kumar }
\date{March 2016}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newcommand{\qed}{\blacksquare }
\begin{document}
\maketitle
\section{Introduction}

\section{Introduction}
Diffusionsariseinvariousapplicationareas.Theyare

widelyusedinmyriadfieldsincludingfinance,economics,
physics\citep{Oksendal2003}\citep{Kloeden1999}and
biologicalsciences\citep{Jenkins2010}.Motionofamolecule
\citep{Maki},fluctuationsinthestockmarket\citep{Black1973}are
commoninstancesstudiedthroughthediffusionprocesses.Sometimes
discreteprocessessuchasthepopulationgrowthcanbeverywell
approximatedbydiffusionprocessesasthetimediscretizationtendsto
becomenegligiblysmall\citep{Tuckwell1974}.Thetransitiondensityof
diffusionstypicallyisunknown,therefore,Eulerdiscretizationmethod
iscustomarilyusedforstudyingtheunderlinedbehaviour.Thestudyof
intractablediffusionsmodelusingdiscretizationmethodsofteninvolves
MonteCarlosimulationsinturngivingrisetoMonteCarloand
discretizationerrors.Controllingdiscretizationerroris
computationallyexpensiverenderingtimediscretizationsufficiently
negligible\citep{Kloeden1999}.Thusweseethatapproximationmethods
forsimulationofdiffusionsarenotonlyinexactbutalsoinvolve
enormouscomputationalcost.Consequentlytheneedtopreciselysimulate
trajectoriesofdiffusionswithoutanapproximationerrorarises.Exact
algorithms\citep{Beskos2005,Beskos2006}stipulatemethodtoprecisely
simulatethetrajectoriesofdiffusions.Theyareaclassof
retrospectiveMonteCarlomethodsfordiffusionforsimulatingand
characterizingsamplepathsofdiffusionsoverfinitetimeintervalata
finitecollectionofpoints.Thismethodutilisesrejectionsamplingon
thediffusionpathspace.Whichconsequentlyreliesonfindingsuitable
proposalmeasurestodrawtheproposalsamplepathsaccurately.\\
Considerableinterestinthestudyofintractabledistributionsand
generatingsamplesfromthemwasshown.\citep{Roberts1996}proposeda
diffusionsbasedmethodtoapproximatetheintractabledistributions.
\citep{Roberts1996}considered\textit{Langevindiffusion}whose
invariantdistributionisthedistributionoftheinterest.Precisely
simulatingthetrajectoriesofsuch\textit{Langevindiffusion}isseen
asacircularproblem\citep{Roberts2016}.TheScalableLangevinExact
(ScaLE)\citep{Roberts2016}isanovelalternativetogradientbased
LangevinMCMCschemessuchasMALA\cite{Roberts1996}whichcircumvents
theneedtouseMetropolistypecorrection.Consequentlythe
circumventionofthismethodologyishighlyapplicableto`BigData'
problems.TheScaLEmethodapproximatestheintractabledistributionof
interestwithaquasistationarydistributionofa`killed'
\textit{Langevindiffusion}.\\
Theaimofthisreportistofurnishanintroductiontothecurrent
literatureonexactsimulationfromdiffusionstrajectories.Furthermore
thereportintroducesResampledScalableLangevinExact(ReScaLE)
methodtoapproximateintractabledistributionsofinterestusingrecent
advancesinthestudyofquasistationarybehavior\citep{Blanchet2012}.

The next section walks us through some of the techniques and concepts
utilised during the designing of the algorithms. The first part of the
section 2 explains Rejection sampling used in the construction of the
Exact algorithm. Afterwards it explains the concepts involved in Exact
algorithm. Instances include Brownian motion, Brownian Bridge, and
Poisson processes. Section 3 attempts at explaining the methodology used
in the Exact algorithm, with respect to the application extended to the
diffusion process with drift function $1/(1+x^2)$. Section 4 discusses
the working of ScaLE algorithm combined with its implementation towards
the case of the Cauchy distribution.

\section{Some Basic Techniques}


\subsection{Diffusion Overview and Preliminaries}
This section commences with multiple definitions which prove to be
crucial in the study of diffusions. Firstly we define a $d$ dimensional
stochastic process $\{X_t | t \geq 0\}$ which is a collection of random
variables with its values in $\mathbb{R}^d$. Formally,
\begin{definition}
A $d$ dimensional \textit{stochastic process} is defined on the
probability space $(\mathbf{\Omega}, \mathcal{F}, \mathbb{P})$ where
\begin{itemize}
\item $\mathbf{\Omega}$ is the set of $\mathbb{R}^d$ valued functions
defined on $[0, \infty)$ that is $\mathbf{\Omega} = \{f \, | \, f :
[0, \infty) \rightarrow \mathbb{R}^d\}$ .
\item Here $\mathcal{F}$ is the sigma algebra generated by the set of
functions $\{f \in \mathbf{\Omega} : f(s) \in \mathcal{B}, 0\leq s <
\infty\}$. $\mathcal{B} \in \mathcal{B}^d$ where $\mathcal{B}^d$ is the
Borel sets in $\mathbb{R}^d$ .
\item $\mathbb{P}$ is the probability measure on the finite dimensional
distributions of the the process $X_t | t \geq 0$ on the space $
(\mathbf{\Omega}, \mathcal{F})$.
\end{itemize}
\end{definition}
\begin{definition}
A \textit{sample path/realization/trajectory} of $\{X_t | t \geq 0\}$ is
$\{X_t(\omega) = \omega(t) : \omega \in \mathbf{\Omega}\}$.
\end{definition}
\begin{definition}
A \textit{Markov process } is a stochastic process $\{X_t | t \geq 0\}$
which satisfies the following \textit{`Markov property'}
\begin{align} \label{eq:3.1.1}
\mathbb{P}(X_t \in \mathcal{B} \, | \, \mathcal{F}_s) = \mathbb{P}
(X_t \in \mathcal{B} \, | \, X_s) \quad 0\leq s <t , \, \mathcal{B}
\in \mathcal{B}^d
\end{align}
Here $\mathcal{F}_s$ is the \textit{filtration} which denotes the sigma

algebra generated by $\{f \in \mathbf{\Omega} : f(u) \in \mathcal{B}\}$


for $ 0\leq u < s$ and $\mathcal{B} \in \mathcal{B}^d$.
\end{definition}
Stating unembellished, the definition \eqref{eq:3.1.1} can be
interpreted as the future evolution of the process dependent on the most
recent part known. Distinctively speaking, an additional knowledge
regarding the behavior of the process for $u < s$ has no effect on the
future information $t > s$. \\
Next, we define an important class of stochastic processes pivotal to
the study of diffusion processes. \textit{Brownian motion} forms an
integral part of the study of diffusion processes which in turn is an
important subclass of Markov process. Discovery of Brownian motion dates
back to the study of random motion of pollen grains suspended in liquid
by Robert Brown in 1828 \citep{Oksendal2003} \citep{VanderPas1971}. Such
motion was described as a continuous time stochastic process $\{B_t \, :
t\geq 0\}$ representing the position of the pollen grain at time $t$.
\begin{definition} \label{d:3.4}
A \textit{Brownian motion }$\{B_t \, : t\geq 0\}$ is a continuous time
Markov process with the following properties:
\begin{itemize}
\item $B_t$ is a \textit{Gaussian Process }, i.e. for all $0 \leq t_1
\leq ...\leq t_k$ the joint random variable $B = (B_{t_1}, ..., B_{t_k})
\in \mathbb{R}^{k}$ is a multivariate normal distribution that is
\begin{align}
B \sim MVN(0, \Sigma) \quad \mbox{with} \quad \Sigma_{ij} = Cov(B_{t_i},
B_{t_j})= \min(t_i, t_j)
\end{align}
\item $B_t$ has independent increments, i.e. for all $0 \leq t_1
\leq ...\leq t_k$, $B_{t_1}, B_{t_2}-B_{t_1}, ..., B_{t_k}- B_{t_{k-1}}$
are independent.
\item For $\mathbf{\Omega} = \{f \, | \, f : [0, \infty) \rightarrow
\mathbb{R}^d\}$ such that $f$ is continuous, the mapping $t \rightarrow
B_t(\omega)$ is continuous for almost all $\omega \in \mathbf{\Omega}$
\end{itemize}
\end{definition}
Above characteristics of the Brownian motion can be used to simulate the
trajectories using following algorithm \eqref{a:3.1}
\begin{pseudocode}[Ovalbox]{\textbf{Brownian Motion Simulation}}
{ (t_1,t_2,...,t_k)} \label{a:3.1}
B_0 \GETS 0 \\
\FOR i \GETS 1 \TO k
\DO
\BEGIN
B_{t_i} \sim N(B_{t_{i-1}}, t_i-t_{i-1}) \\
\END \\
\RETURN{B = (B_{t_1},B_{t_2},...,B_{t_k})}
\end{pseudocode}
\begin{figure} \label{f:3}
\centering
\includegraphics[scale=0.4]{brownian.png}
\caption{An illustration of 3 sample paths of Brownian Motion

initialized at $B_0 = 0$.}


\end{figure}
Figure \eqref{f:3} gives three sample path of Brownian motion
initialized at $B_0 =0$.
Sometimes we happen to be interested in the laws of a process which is
nothing but Brownian motion conditioned at ending points. Such a process
is called \textit{Brownian bridge}. Formally,
\begin{definition}
A Brownian Bridge with terminal positions $b_s$ and $b_u$ at times $s$
and $u$ respectively is a stochastic process $\{BB_t : \, s \leq t \leq
u\}$ satisfying,
\begin{align}
BB_t \overset{d}{=} (B_t \, | \, B_s = b_s , B_u = b_u )
\end{align}
\end{definition}
It can be shown that the density of a Brownian bridge at some time point
$t$ is Gaussian. We can show as follows,
\begin{align} \label{3.1.4}
f(BB_t = b_t) & = f(B_t = b_t \, |\, B_s = b_s , B_u =
b_u) \\ \label{3.1.5}
& \propto f(B_u = b_u \, |\, B_s = b_s , B_t = b_t) f(B_t = b_t \, | \,
B_s = b_s) \\ \label{3.1.6}
& \propto f(B_u = b_u \, |\, B_t = b_t) f(B_t = b_t \, | \, B_s =
b_s) \\ \label{3.1.7}
& = \mathcal{N} (b_u; b_t,u-t) \mathcal{N} (b_t; b_s,ts) \\ \label{3.1.8}
& \propto \exp\left\{ - \frac{1}{2} \frac{(b_u -b_t)^2}{(ut)}\right\} \cdot \exp\left\{ - \frac{1}{2} \frac{(b_t -b_s)^2}{(ts)}\right\} \\ \label{3.1.9}
& \propto \exp \left\{- \frac{1}{2} \frac{\left(b_t - \frac{b_s (u-t) +
b_u (t-s)}{(u-s)}\right)^2}{\frac{(u-t)(t-s)}{(us)}}\right\} \\ \label{3.1.10}
& \propto \mathcal{N}\left( b_t; \frac{b_s (u-t) + b_u (t-s)}{(u-s)},
\frac{(u-t)(t-s)}{(u-s)} \right)
\end{align}
Proportionality \eqref{3.1.6} follows using \textit{Markov} property
\eqref{eq:3.1.1}. $\mathcal{N}(x; \mu, \sigma)$ is the density of a
Normal distribution with mean $\mu$ and variance $\sigma $ evaluated at
$x$. \eqref{3.1.9} is simply a rearrangement of \eqref{3.1.8} after
completing the square. This result turns useful while simulating
intermediate points in the exact algorithm. Although it's not possible
to simulate an entire Brownian bridge sample path, it can be simulated
at finite collection of points $\{t_1,...,t_n\}$ within an interval $[s,
u]$. Algorithm \eqref{a.3.2} simulates a Brownian bridge at times $\
{t_1,...,t_n\}$
\begin{pseudocode}[Ovalbox]{\textbf{Brownian Bridge Simulation}}
{t_1,t_2,...,t_n} \label{a.3.2}
t_0 \GETS s , t_{n+1} \GETS u \\
BB_{t_0} \GETS b_s , BB_{t_{n+1}} \GETS b_u\\
BB \GETS \{(t_0, BB_{t_0}), (t_{n+1}, BB_{t_{n+1}})\} \\
\FOR i \GETS 1 \TO n
\DO
\BEGIN

t_l \GETS \sup\{BB \, : \, BB \leq t_i\}, \quad t_r \GETS \inf\{BB \, :


\, BB \geq t_i\} \\
R_{t_i} \sim N(0,1) \\
BB_{t_i} \GETS \frac{BB_{t_{l}}(t_{r}-t_i)+BB_{t_{r}}(t_i-t_{l})}
{(t_{r}-t_{l})}+ \sqrt{\left(\frac{(t_{r}-t_i)(t_i-t_{l})}{(t_{r}t_{l})}\right)}R_{t_i} \\
BB \GETS BB \, \cup (t_i, BB_{t_i})
\END \\
\RETURN{BB}
\end{pseudocode} \\
Figure \ref{bb} is an illustration of the sample paths of a Brownian
bridge.
\begin{figure}[ht]
\centering
\includegraphics[scale=0.4]{BB.png}
\caption{An illustration of 3 sample path of Brownian Bridge for 1000
equally distant time points between 0 and 1. Trajectory is conditioned
on $B_0 =0, B_1 =0$}
\label{bb}
\end{figure}
Now we are able to define the diffusion processes.
\begin{definition}
\textit{Diffusion processes} are special kinds of \textit{Markov
processes} where sample paths are continuous. Formally speaking, it is a
stochastic process $\{X_t | t \geq 0\}$ defined on $
(\mathbf{\Omega}, \mathcal{F}, \mathbb{P})$ with $\mathbf{\Omega} = \
{f \, | \, f : [0, \infty) \rightarrow \mathbb{R}^d\}$ such that $f$ is
continuous.
\end{definition}
Many real world phenomenons are continuously changing albeit change is
not deterministic. Movements of ink molecules in a liquid is a good
example of diffusion processes. Behavior of diffusion processes $X_t$
can be noticed by studying the state visited by the process and its
variation, with respect to time. Further, movements of $X_t$ can be
decomposed into two components - one which is deterministic, often
called the drift and other component being random noise. This leads to
the notion of \textit{Stochastic Differential Equations } (SDE) of which
diffusion process $X_t$ is a solution. Generally, a SDE is of the form
\begin{align} \label{eq:3.1.2}
dX_t = \mu(X_t, t) dt + \sigma(X_t, t) dB_t
\end{align}
$\mu(X_t, t)$ in \eqref{eq:3.1.2} denotes instantaneous drift
coefficient while $\sigma(X_t, t) $ is instantaneous diffusion
coefficient. $B_t$ is a $d-$ dimensional Brownian motion\footnote{A
$d-$ dimensional analogue of \eqref{d:3.4}. Further details can be found
at \citep{Oksendal2003}} \\
Exact algorithm is applied to obtain sample trajectories from an
important subclass of diffusion processes called It\^{o} diffusion.
Formally,

\begin{definition}
A It\^{o} diffusion $\{X_t \, | t \geq 0\}$ is characterized by the SDE
\begin{align}
dX_t = \mu(X_t, t) dt + \sigma(X_t, t) dB_t
\end{align}
is a stochastic process defined on $(\mathbf{\Omega}, \mathcal{F},
\mathbb{P})$ such that
\begin{itemize}
\item $\mu(X_t, t)$ is $\mathcal{F}_t$ measurable and
$\mathbb{P}\left( \int \limits_0^t |\mu(X_s, s)| ds < \infty, \forall \,
t \geq 0\right) = 1$
\item $\mathbb{P}\left(\int \limits_0^t |\sigma(X_s, s)|^2 ds <
\infty, \forall \, t \geq 0\right) = 1$
\end{itemize}
\end{definition}
Next we discuss an important result that best describes the changes in
the behavior of a It\^{o} diffusion defined on $(\mathbf{\Omega},
\mathcal{F}, \mathbb{P})$ if there is a change in the probability
measure from $\mathbb{P}$ to $\mathbb{Q}$. We can informally apply this
transformation to a given It\^{o} diffusion to obtain another. It is
\^{o} diffusion facilitating simulation studies. These transformations
keep solutions unchanged but transformed SDE will have different drift
and diffusion coefficient since the underlined probability measure is
different.
\begin{theorem}[Girsanov's Theorem]
Consider a It\^{o} diffusion $dX_t = \mu(X_t, t) dt + \sigma(X_t, t)
dB_t$ defined on $(\mathbf{\Omega}, \mathcal{F}, \mathbb{P})$. A driftless It\^{o} diffusion $Y_t = \sigma(Y_t, t) dB_t$ on probability space
$(\mathbf{\Omega}, \mathcal{F}, \mathbb{Q})$ satisfies,
\begin{align}
\frac{d\mathbb{P}}{d\mathbb{Q}}(X_t) = \exp\left( \int \limits_0^t
\frac{\mu(X_t, t)}{\sigma^2(X_t, t)}dX_t - \frac{1}{2}\int
\limits_0^t \frac{\mu^2(X_t, t)}{\sigma^2(X_t, t)}dt \right)
\end{align}
\end{theorem}
Now we discuss about Poisson process which is a counting process on $[0,
\infty)$. A Poisson process counts the number of times an event has
occurred in a given time interval. It is one of the most prominent
stochastic process used to model arrival process of customers or calls
in a telephone exchange \citep{Ross2010}.
\begin{definition}
A Poisson process of varying arrival rate $\lambda(t)$ is a continuous
time stochastic process $\{N(t): t\geq 0 \}$ which counts the number of
events in $[0,t]$ and it satisfies the following properties:
\begin{enumerate}
\item[\textbf{P1}. ] $\{N(t): t\geq 0 \}$ has independent increment
property, i.e., for any partition $P_n:= \{0=t_0<t_1<...<t_n=t\}$ of the
interval $[0,t]$ for some $t>0$, the random variables of counts $\{{N}
(t_{i-1}, t_{i}):= N(t_i)-N(t_{i-1})|i = 1,2,...,n \}$ are mutually
independent.

\item[\textbf{P2}. ] $\forall \, t\geq 0, \delta >0$,


\begin{align} \label{eq:2.1}
P({N}(t, t+\delta) = 0) &= 1- \lambda(t)\delta
+o(\delta) \\ \label{eq:2.2}
P({N}(t, t+\delta) = 1) &= \lambda(t)\delta
+o(\delta) \\ \label{eq:2.3}
P({N}(t, t+\delta) \geq 2) &= o(\delta)
\end{align}
\end{enumerate}
\end{definition}
It becomes crystal clear from the definition that Poisson process
eliminates the chances of occurrence of two or more events in a small
time interval. It can be proved that the number of events in an interval
is a Poisson random variable. Formally,
\begin{theorem} \label{t3.2}
Consider a Poisson process $\{N(t): t\geq 0 \}$ of rate $\lambda(t)$.
Under the above assumption, $N(t) -$ the number of events in the
interval $[0, t]$ is a Poisson distribution with parameter $\int
\limits_{0}^t \lambda(s) ds$.
\end{theorem}
\begin{proof}
Given in appendix \eqref{Appendix}.
\end{proof}
It can be shown that waiting time for an event in a Poisson process is
exponentially distributed. A formal proof of this property can be found
in \citep{Kingman1993}, \citep{Ross2010}. We can use this property to
simulate a Poisson process of constant rate $\lambda$ (often known as
homogeneous Poisson process). Algorithm \ref{a3.3} summarizes waiting
time approach for simulating from a homogeneous Poisson process of rate
$\lambda$. We will use algorithm $\ref{a3.3}$ at multiple places in this
report.
\begin{pseudocode}[Ovalbox]{\textbf{Time Homogeneous Poisson Process
Simulation}}{\lambda, t} \label{a3.3}
i \GETS 0 , W_0 \GETS 0 \\
\WHILE \sum \limits_i W_i \leq t
\DO
\BEGIN
i \GETS i+1 \\
W_i \sim Exp(\lambda) \\
T_i \GETS T_{i-1} + W_i
\END \\
\RETURN{n = i-1, \text{Event Times} = (T_1, T_2,..., T_{i-1})}
\end{pseudocode}
\subsection{Rejection Sampling}
Rejection sampling is a Monte-Carlo method to simulate from some
``target" density $f$ (from which sampling is not possible) with the aid
of ``proposal" density $g$. The target density can be turned into
following identity
\begin{align} \label{eq:2.1.1}
f(x) = \int \limits_{0}^{f(x)} \mathbb{I} \, dy = \int
\limits_{0}^{1} \mathbb{I}_{\{0 \leq y \leq f(x)\}} \, dy = \int

\limits_{0}^{1} f(x, y) \, dy
\end{align}
$f(x)$ in \eqref{eq:2.1.1} can be viewed as the marginal density of
$f(x,y) = \mathbb{I}_{\{0 \leq y \leq f(x)\}}$. Thus $f(x)$ is the
marginal density of uniform distribution on rectangle $\{(x,y): 0 \leq y
\leq f(x)\}$ given by the area under the graph. We can generate samples
from $f$ by sampling within the area under the curve. Above idea can not
be translated to unbounded densities or densities with unbounded
support. Thus we choose a proposal density $g$ in such a way that
$\exists M >0$ with
\begin{align} \label{eq:2.1.2}
f(x) \leq g(x) M \quad \forall \, x
\end{align}
Thus instead of sampling directly from $f$, we sample $X$ from $g$ and
accept the sampled values with probability $P = \frac{1}{M}\frac{f(X)}
{g(X)}$ otherwise reject $X$ as the candidate sample from $f$. Thus
simplest version of rejection sampling is
\begin{pseudocode}[Ovalbox]{\textbf{Rejection Sampling Method}}{M, f, g}
1. \quad X \sim g \\
2. \quad u \sim U[0,1] \\
3. \quad \IF u \leq \frac{1}{M}\frac{f(X)}{g(X)} \quad \GOTO 4. \quad
\mbox{otherwise} \quad \GOTO 1. \\
4. \quad \RETURN{X}
\end{pseudocode}
\begin{proof}
Let $\Omega$ denote the set of all possible values of $X$. Assume $A
\subset \Omega$. Probability that values of $X$ lies in $A$ given that
it was accepted is shown by
\begin{align} \label{eq:2.1.3}
P\left(X \in A \left| \right. u \leq \frac{1}{M}\frac{f(X)}{g(X)}\right)
&= \frac{P\left(X \in A, u \leq \frac{1}{M}\frac{f(X)}{g(X)}\right)}
{P\left(u \leq \frac{1}{M}\frac{f(X)}{g(X)}\right)} \\ \label{eq:2.1.4}
&= \frac{\int \limits_{A} {\frac{1}{M}\frac{f(y)}{g(y)}} g(y) dy}
{\int \limits_{\Omega} {\frac{1}{M}\frac{f(y)}{g(y)}} g(y)
dy}\\ \label{eq:2.1.5}
&= \frac{\int \limits_{A} f(y) dy}{\int \limits_{\Omega}^\infty f(y) dy}
= P\left(X \in A\right)
\end{align}
The last equality \eqref{eq:2.1.5} follows since denominator in
\eqref{eq:2.1.5} equals one (We are integrating over all possible values
of X ). Thus simulating samples $X_i \sim g$ and retaining the sample if
$u_i \leq \frac{1}{M}\frac{f(X_i)}{g(X_i)}$ gives i.i.d sample from
target $f$.
\end{proof}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{Rplot.png}
\caption{An illustration of rejection sampling}
\end{figure}
Figure 1 gives an intuitive explanation of rejection sampling. Suppose
we want to uniformly simulate points from the subgraph. It is denoted by

yellow region in the graph but due to the difficult simulation from the
density $f$, we simulate points uniformly from the graph with yellow and
grey region together. Simulating points uniformly from the subgraph $\
{(x,u)\in S_q \times R^+:q(x)\leq u\}$ is achieved by first simulating
points $X_1, X_2, ...$ from the support of $q$ i.e. $S_q$ and then
drawing $u_1, u_2, ...$ independently according to $U[0, Mq(X_i)]$ for
$i \in \{1,2,...\}$. This gives coordinates $\{(X_i,u_i): i \in \
{1,2,...\}\}$ on the graph. Next we retain points according to their
position on the subgraph. If point $(X_i,u_i)$ fall in the yellow area
then $X_i$ is retained as candidate sample from target density $p$. Each
simulated point $X_i \sim q$ has acceptance probability $\frac{1}
{M}\frac{p(X_i)}{q(X_i)}$ of being accepted as candidate sample from the
target density $p$. Algorithm stops until $N$ points has been retained.
This method gives i.i.d sample from target density which can be
illustrated as follow:

You might also like