MyNixOS website logo
Description

Approximating Evidence via Bounded Harmonic Means.

Implements the Elliptical Covering Marginal Likelihood Estimator (ECMLE), a geometric method for approximating marginal likelihood from posterior draws and log-posterior evaluations. The method constructs a collection of non-overlapping ellipsoids in a high-posterior-density region, computes the covered volume, and combines this with posterior sample coverage to estimate model evidence. It is designed to stabilize harmonic-mean-based evidence approximation and can be applied in multimodal settings. The methodology is described in Naderi et al. (2025) <doi:10.48550/arXiv.2510.20617>.

ECMLE

ECMLE is an R package for the Elliptical Covering Marginal Likelihood Estimator. It implements a geometric marginal-likelihood estimator based on posterior draws, log-posterior evaluations, and ellipsoidal coverings of a high-posterior-density region.

The method is described in:

Naderi et al. (2025). Approximating Evidence via Bounded Harmonic Means.https://doi.org/10.48550/arXiv.2510.20617

Installation

install.packages("ECMLE")

Main function

ecmle(post_samples, lps, log_post_fn, hpd_level = 0.75)

Arguments

  • post_samples: matrix of posterior draws, one row per draw.
  • lps: numeric vector of log-posterior values at post_samples.
  • log_post_fn: function returning the log unnormalized posterior density (log prior + log likelihood) at a parameter vector.
  • hpd_level: HPD fraction used to define the packing region.

Minimal example

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(
  post_samples = post_samples,
  lps          = lps,
  log_post_fn  = log_post_fn,
  hpd_level    = 0.75
)
print(fit)
plot(fit)

Package contents

  • ecmle(): estimates the log marginal likelihood.
  • summary(): returns a compact summary of an ecmle fit.
  • plot(): shows the running estimate across the evaluation half-sample.
  • plot_ecmle_2d(), draw_ellipse_2d(): 2-D visualisation of fitted ellipsoids.
  • pair_plot(): lower-triangular pair plot for posterior sample matrices.
  • rosenbrock_generate_data(), rosenbrock_exact_posterior(), rosenbrock_log_post(), rosenbrock_log_post_vec(): Rosenbrock (banana) posterior benchmark functions.

License

GPL-3

Metadata

Version

0.1.0

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows