Skip to content

MCMCVisualizerMCMC Diagnostics & Visualization

Parse, analyze, plot, and export MCMC sampling data. Works in browsers, Node.js, and from the command line. Zero runtime dependencies.

MCMCVisualizer

Quick Start

bash
npm install mcmc-visualizer
typescript
import { fromChainArrays, plots } from 'mcmc-visualizer';

const data = fromChainArrays({
  'chain#1': { mu: [1.2, 1.3, 1.1, 1.4], sigma: [0.5, 0.6, 0.5, 0.7] },
  'chain#2': { mu: [1.0, 1.5, 1.2, 1.3], sigma: [0.4, 0.5, 0.6, 0.5] },
});

// Compute diagnostics
const stats = data.variableStats('mu');
console.log(stats.rhat, stats.bulkEss); // 1.001, 3847

// Render a trace plot into a DOM element
plots.tracePlot(document.getElementById('plot'), data, 'mu');

// Get a full summary table
const summary = data.summary();
// [{ variable: 'mu', mean: 1.25, rhat: 1.001, bulkEss: 3847, ... }]

Supported Formats

FormatReadWrite
Turing.jl CSV (long)yes
Turing.jl CSV (wide)yes
Stan CSVyes
MCMCChains.jl JSONyes
ArviZ JSONyes
Generic JSONyesyes
Raw arraysyes

Released under the MIT License.