Skip to contents

Iterative optimal-bridge estimate of r = c1/c2 (Meng and Wong 1996, eq. 3.5 and Sec. 4), with a common log-shift for overflow safety that cancels exactly.

Usage

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

Arguments

draws1, draws2

Draws from p1 and p2.

log_q1, log_q2

Log unnormalized densities.

tol

Relative fixed-point tolerance on log r.

max_iter

Iteration cap.

Value

List with estimate (r), log_r, n_iter, converged, method.

References

Meng, X.-L. and Wong, W. H. (1996), Statistica Sinica 6, 831-860, eq. (3.5), Sec. 4.

Examples

set.seed(2)
d1 <- rnorm(400, 0, 1)
d2 <- rnorm(400, 0.5, 1.2)
r <- Bridgs(d1, d2,
            log_q1 = function(x) -0.5 * x^2,
            log_q2 = function(x) -0.5 * ((x - 0.5) / 1.2)^2)
str(r, max.level = 1)
#> List of 7
#>  $ ratio     : num 0.801
#>  $ log_ratio : num -0.222
#>  $ iterations: int 8
#>  $ converged : logi TRUE
#>  $ n1        : int 400
#>  $ n2        : int 400
#>  $ method    : chr "Meng-Wong iterative optimal bridge (eq. 3.5 / Sec. 4)"