Rao-Blackwellization

Recall: Rao-Blackwell Theorem

(Lehmann & Casella, 1998)
Rao-Blackwellization is that
(Robert & Casella, 2005)

Example: Student's
tt
expectation

(Robert & Casella, 2005)
Here Gamma is in (α, β) form.
Alternative way to look at such decomposition
(Robert & Casella, 2010)
Compare the performance with two cases,
1
using Distributions
2
using Plots
3
4
function rt_dickey(n, μ, ν, σ)
5
# sample y firstly
6
dist_y = InverseGamma(ν/2, ν/2)
7
ys = rand(dist_y, n)
8
# sample x
9
xs = σ * randn(n) .* sqrt.(ys) .+ μ
10
return xs, ys
11
end
12
13
function cmp_res(n, μ, ν, σ)
14
xs, ys = rt_dickey(n, μ, ν, σ)
15
cum_δm = cumsum( exp.(- xs .^2) )
16
cum_δm_star = cumsum( 1 ./ sqrt.(2 * σ^2 .* ys .+ 1) .* exp.(-μ^2 ./ (1 .+ 2*σ^2 .* ys)) )
17
δm = cum_δm ./ (1:n)
18
δm_star = cum_δm_star ./ (1:n)
19
p = plot(δm, label = "MC")
20
plot!(p, δm_star, label = "RB")
21
return p
22
end
23
24
using Random
25
Random.seed!(123)
26
p1 = cmp_res(10000, 0, 4.6, 1)
27
p2 = cmp_res(10000, 3, 5, 0.5)
28
plot(p1, p2)
29
savefig("two-situations.svg")
Copied!
Last modified 1yr ago