File ess_window_updater.hpp

template<typename NT, typename VT, typename MT>
class ESSestimator
#include <ess_window_updater.hpp>

This is a class that updates the effective sample size (ess) of a sample given a new chain using Welford’s algorithm to update the average values and the variance estimates where needed. The chains has to be of the same length. The ess estimation exploits Geyer’s stable estimator for the autocovariance and the Geyer’s conversion to a monotone sequence, given in,

Charles J. Geyer, Practical Markov Chain Monte Carlo, Statistical Science 1992.

Template Parameters:
  • NT – number type

  • VT – vector type

  • MT – matrix type

Public Functions

inline ESSestimator()
inline ESSestimator(unsigned int const &_ndraws, unsigned int const &_dim)
inline void update_estimator(MT const &samples)
inline void estimate_effective_sample_size()
inline VT get_effective_sample_size()

Private Members

unsigned int num_draws
unsigned int max_s
unsigned int s
unsigned int d
unsigned int num_chains
unsigned int jj
VT cm_mean
VT cm_var
VT cv_mean
VT draws
VT var_plus
VT ess
VT auto_cov
NT oldM
NT rho_hat_odd
NT rho_hat_even
NT mean_var
NT M2
NT delta
NT new_elem
MT acov_s_mean
MT rho_hat_s