# Rejection Sampling and Metropolis Algorithm MATH8050: Homework 6 solution

\$30.00

Category:

## Description

1. (90pts total, equally weighted) We write X ∼ Be(α, β) if X has the beta distribution with parameters
α > 0 and β > 0, that is, its pdf is
p(x | α, β) = Be(x | α, β) = 1
B(α, β)
x
α−1
(1 − x)
β−1
,
where B(α, β) is the beta function. Suppose that we want to generate samples from the following target
density (known up to a constant)
f(x; α, β) ∝ x
α−1
(1 − x)
β−1
,
with α = 2.7, β = 6.3. Work on the following questions.
(a) Plot the densities of f(x; α = 2.7, β = 6.3) and the Uniform distribution U(0, 1). According to the
rejection sampling approach, sample from the beta distribution using the U(0, 1) pdf as an enveloping
function.
1
(b) Plot the histogram of the points that fall in the acceptance region. Do this for a simulation size of 102
and 105 and report your acceptance ratio. Compare the ratios and histograms.
(c) Instead of using the uniform distribution, using Be(2, 6) as the enveloping function. Then repeat the