BFMI is inconsistent with the paper
Summary:
The BFMI implementation is inconsistent with the original paper.
Description:
The numerator in get_bfmi is divided by the length of x
https://github.com/stan-dev/rstan/blob/f79dae16e3bc187601520a165916b4d39d83af8d/rstan/rstan/R/check_hmc_diagnostics.R#L231
This is consistent with the paper's equation (bottom of page 7) if var gives the maximum likelihood estimate, but it gives the unbiased estimator instead. The resulting BFMI is off by a factor of (length(x) - 1) / length(x)
PyStan's implementation agrees with the paper (numpy.var defaults to the maximum likelihood estimate).
Noticed something off about this today too so I'm seconding this observation! Shouldn't it be mean(diff(energy) ^ 2) / var(energy)?