ECMLE implements Elliptical Covering Marginal
Likelihood Estimator. The package is designed for settings
where you have posterior draws, their log-posterior evaluations, and a
function that can evaluate the log-posterior kernel away from the
sampled points.
set.seed(1)
post_samples <- cbind(rnorm(400), rnorm(400))
lps <- apply(post_samples, 1, function(z) sum(dnorm(z, log = TRUE)))
log_post_fn <- function(theta) sum(dnorm(theta, log = TRUE))
fit <- ECMLE::ecmle(
post_samples = post_samples,
lps = lps,
log_post_fn = log_post_fn,
hpd_level = 0.75,
seed = 123
)
fit
#> <ecmle>
#> log marginal likelihood: 0.0517178
#> ellipsoids: 1
#> coverage rate: 0.575
summary(fit)
#> ECMLE summary
#> log marginal likelihood: 0.0517178
#> ellipsoids: 1
#> total volume: 6.62691
#> HPD level: 0.75