#include <triqs/stat.hpp>


  1. template<typename F, typename A>
    auto jackknife (F && f, A const &… a)
  2. template<typename F, typename T>
    auto jackknife (F && f, accumulator<T> const &… a)

Calculate the value and error of a general function \(f\) of the average of sampled observables \(f\left(\langle \mathbf{a} \rangle\right)\), using jackknife resampling.

1) Directly pass data-series in vector like objects

2) Pass accumulators, where the jacknife acts on the linear binned data

Template parameters

  • F return type of function f which acts on data
  • A vector-like object, defining size() and []
  • T type of data stored in the accumulators


  • a one or multiple series with data: \(\mathbf{a} = \{a_1, a_2, a_3, \ldots\}\) Pre-condition: if more than one series is passed, the series have to be equal in size
  • f a function which acts on the \(i^\mathrm{th}\) elements of the series in a:
\[\left(a_1[i], a_2[i],a_3[i],\ldots\right) \to f\left(a_1[i],a_2[i],a_3[i],\ldots\right)\]


std::tuple with four statistical estimators \(\left(f_\mathrm{J}^{*}, \Delta{f}_\mathrm{J}, f_\mathrm{J}, f_\mathrm{direct}\right)\), defined below.

Jackknife resampling takes \(N\) data points \(\mathbf{a}[i]\) and creates \(N\) samples (“jackknifed data”), which we denote \(\tilde{\mathbf{a}}[i]\). We calculate three statistical estimators for \(f\left(\langle \mathbf{a} \rangle\right)\):
  • The function \(f\) applied to observed mean of the data
\[f_\mathrm{direct} = f\left(\bar{\mathbf{a}}\right),\quad \bar{\mathbf{a}} = \frac{1}{N}\sum_{i=0}^{N}\mathbf{a}[i]\]
  • The jacknife estimate defined as
\[f_\mathrm{J} = \frac{1}{N}\sum_{i=0}^N f(\tilde{\mathbf{a}}[i])\]
  • The jacknife estimate, with bias correction to remove \(O(1/N)\) effects
\[f_\mathrm{J}^{*} = N f_\mathrm{direct} - (N - 1) f_\mathrm{J}\]
Additionally, an estimate in the errror of \(f\left(\langle \mathbf{a} \rangle\right)\) is given by the jacknife as
\[\Delta{f}_J = \sqrt{N-1} \cdot \sigma_f\]
where \(\sigma_f\) is the standard deviation of \(\left\{f(\tilde{\mathbf{a}}[0]), f(\tilde{\mathbf{a}}[1]), \ldots, f(\tilde{\mathbf{a}}[N])\right\}\).