Skip to main content
QUICK REVIEW

[Paper Review] GetDist: a Python package for analysing Monte Carlo samples

Antony Lewis|arXiv (Cornell University)|Oct 30, 2019
Forecasting Techniques and Applications1 references508 citations
TL;DR

GetDist provides kernel density estimation and visualization tools tailored for weighted and correlated Monte Carlo samples, with boundary handling and multiplicative bias correction to compute marginalized densities and convergence diagnostics.

ABSTRACT

Monte Carlo techniques, including MCMC and other methods, are widely used in Bayesian inference to generate sets of samples from a parameter space of interest. The Python GetDist package provides tools for analysing these samples and calculating marginalized one- and two-dimensional densities using Kernel Density Estimation (KDE). Many Monte Carlo methods produce correlated and/or weighted samples, for example produced by MCMC, nested, or importance sampling, and there can be hard boundary priors. GetDist's baseline method consists of applying a linear boundary kernel, and then using multiplicative bias correction. The smoothing bandwidth is selected automatically following Botev et al., based on a mixture of heuristics and optimization results using the expected scaling with an effective number of samples (defined here to account for both MCMC correlations and weights). Two-dimensional KDE uses an automatically-determined elliptical Gaussian kernel for correlated distributions. The package includes tools for producing a variety of publication-quality figures using a simple named-parameter interface, as well as a graphical user interface that can be used for interactive exploration. It can also calculate convergence diagnostics, produce tables of limits, and output in LaTeX, and is publicly available.

Motivation & Objective

  • Present a fast, robust method to estimate marginalized 1D and 2D densities from Monte Carlo samples (including weighted and correlated samples).
  • Address challenges from hard boundaries and sample correlations in KDE.
  • Provide practical, publication-quality figures and diagnostics for MC samples.
  • Offer automatic bandwidth selection and bias-correction techniques to improve density estimates.

Proposed method

  • Use kernel density estimation with (slightly truncated) zero-centered Gaussian kernels for density estimation.
  • Handle weighted samples and correlations by adjusting the KDE via effective sample size and weighting, including an explicit equation for the density estimator with weights.
  • Introduce linear boundary kernels to mitigate bias near hard priors, and apply multiplicative bias correction to reduce residual bias and improve peak sharpness.
  • Adopt an auto-bandwidth selection method, including an ISJ-based approach with Discrete Cosine Transform to handle boundaries efficiently.
  • Provide a practical framework for producing publication-quality plots and LaTeX-ready outputs, with optional GUI for exploration.

Experimental results

Research questions

  • RQ1How can KDE be adapted to accurately estimate marginalized densities from weighted and correlated MC samples?
  • RQ2What boundary treatment and bias-correction strategies yield reliable density estimates near hard priors?
  • RQ3How should kernel bandwidth be chosen automatically in the presence of correlations and varying effective sample sizes?
  • RQ4What is the impact of correlation on KDE error, and how can effective sample size be estimated for KDE in MC contexts?
  • RQ5Can GetDist deliver robust, publication-quality visuals and convergence diagnostics for MC analyses?

Key findings

  • A KDE-based approach with linear boundary kernels and multiplicative bias correction yields accurate 1D and 2D marginalized densities from weighted and correlated MC samples.
  • Automatic bandwidth selection using an ISJ-based method with a DCT accelerates bandwidth estimation and handles boundary effects.
  • The method accounts for effective sample size to adjust smoothing in the presence of weights and MCMC correlations, improving density estimates.
  • Correlations in MC samples affect variance through an effective sample size, influencing the KDE error scaling and bandwidth choices.
  • GetDist provides tools for convergence diagnostics, limit tables, and LaTeX output alongside interactive plotting capabilities.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.