Skip to contents

Estimates \(r = c_1 / c_2\) from draws under each unnormalised density using the optimal bridge of Meng and Wong (1996), eq. (3.5), evaluated by their Sec. 4 fixed-point iteration. The estimator uses BOTH sets of draws, which is what makes it far more stable than a one-sided importance-sampling ratio when the two densities overlap only partially.

Usage

morie_bridgs(draws1, draws2, log_q1, log_q2, tol = 1e-12, max_iter = 1000L)

Arguments

draws1, draws2

Lists of draws from the first and second density.

log_q1, log_q2

Functions giving the unnormalised log densities.

tol

Relative convergence tolerance on \(\log r\).

max_iter

Maximum iterations.

Value

A list with ratio, log_ratio, iterations, converged, n1, n2, method.

References

Meng, X.-L. and Wong, W. H. (1996). Simulating ratios of normalizing constants via a simple identity. Statistica Sinica, 6, 831-860.

Examples

set.seed(1)
morie_bridgs(draws1 = as.list(rnorm(100)), draws2 = as.list(rnorm(100, 0.5)),
             log_q1 = function(x) -0.5 * x^2,
             log_q2 = function(x) -0.5 * (x - 0.5)^2)
#> $ratio
#> [1] 0.9842358
#> 
#> $log_ratio
#> [1] -0.01588974
#> 
#> $iterations
#> [1] 7
#> 
#> $converged
#> [1] TRUE
#> 
#> $n1
#> [1] 100
#> 
#> $n2
#> [1] 100
#> 
#> $method
#> [1] "Meng-Wong iterative optimal bridge (eq. 3.5 / Sec. 4)"
#>