Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
STA120
Worksheet 13 Piero Lorenzini, Stefan Willi
Problem 31 (Monte Carlo integration)
Estimate the volume of the unit ball in d = 2, 3, . . . , 10 dimensions and compare it to the exact value . What do you notice?
Hint : You may adapt the RCode 14.2 from the script.
Problem 32 (Rejection sampling 1)
We want to draw a sample from a distribution with a density proportional to y(1 − y)(y + 1) for y ∈ [0, 1], i.e.
fY (y) ∝ y(1− y)(y + 1).
Use
fZ(y) = I0≤y≤1(y) =
{
1 if 0 ≤ y ≤ 1
0 otherwise
as proposal density and draw 100’000 realizations of the density above with a rejection sampling approach.
Problem 33 (Rejection sampling 2 – difficult)
A random variable X has a Laplace distribution with parameters µ ∈ R and λ > 0 if its density is of the form
fX(x) =
1
2λ
exp
(
−|x− µ|
λ
)
.
(a) Draw 1000 realizations of a Laplace distribution with parameters µ = 0 and λ = 1 with a rejection sampling
approach.
Hint : For the proposal density you can use the density of the t-distribution with 1 degree of freedom.
(b) Propose an intuitive alternative sampling approach based on rexp().