\section{WHAM and MBAR}

The weighted histogram analysis method~\cite{kumar:1992a,roux???}, the
most commonly known variant of the multiple histogram methods
introduced by Swendsen and Ferrenberg~\cite{ferrenberg:1989a} is by
far the most common way of computing free energies and expectation
averages using samples from multiple states, with over a thousand
references to date.  In WHAM-based techniques, an order parameter
(which can be a spatial coordinate, a set of coordinates, or potential
energy) is partioned into a number of bins $M=1 \ldots j$.  $K$
simulations are carried at different thermodynamics states with
reduced potentials $u_i, i=1 \ldots K$.  The probability of observing
a given value of the the order parameter during the simulation is
approximated by the number of times the corresponding bin $j$ is
observed over all simulations $\sum_i n_{ij}$, divided by the total
number of samples from all simulations $\sum_i N_i$, where $n_{ij}$ is
the number of bin observations (or histogram counts) in the $j$th bin
from the $i$th simulation.

The true probability distribution of the set of simulations at order
parameter value $x$ is a weighted mixture of the $K$ different
probability distributions:
\begin{eqnarray}
P(x) = \frac{\sum_i N_i\exp{(f_i - u_i(x))}}{\sum_i N_i}
\end{eqnarray}

For any bin $j$, where $u_{ij}$ is the reduced energy evaluated over
bin $j$ we can set these estimates equal:
\begin{eqnarray}
\frac{\sum_i n_{ij}}{\sum_i N_i} &=&  \frac{\sum_i N_i\exp{(f_i - u_{ij})}}{\sum_i N_i} \\
\sum_i n_{ij} &=& \sum_i N_i\exp{(f_i - u_{ij})} \\
\end{eqnarray}

This set of $M$ equations, which have been written in a number of
different ways in different papers, can be solved self-consistently to
find the $K$ $f_i$. Expectation values in each bin of an arbitrary
function $A$, where $A_{ij}$ is the value of the function $A$ in the
$i$th thermodynamic state and $j$th bin.

We can connect the WHAM and MBAR methods by noting that if the reduced
potential function $u_i(x)$ is replaced by binned reduced energy
function $u_{ij}$, then we immediately recover the WHAM equations.
WHAM therefore represents a histogram kernel density approximation to
the MBAR equations.  If the system is inherenetly discrete, and WHAM
is used with the same discretiziation, then the free energies obtained
will be identical.  

By making this connection, we can see that there are fundamental
theoretical advantages of MBAR over WHAM.  First, the reliance on
histograms of width sufficient to contain many samples introduces a
bias that can be substantial and often difficult to
assess~\cite{kobrak:j-comput-chem:2003:histogram-error}.  One clear
issue with biasing is that free energy barriers will always be
underestimated, sometimes signficantly.  When computing a PMF, the
values of minima are likely to be accurately estimated, because the
minima will have the largest Boltzmann weight.  However, barriers are
free energy maxima, and thus will have the lowest Boltzmann weight
over the bin, and will be be underrepresented in the average.  This
can be seen very clearly in a recent study that compared MBAR and WHAM
in their ability.~\cite{mccammonetc}

Second, unlike with MBAR, there are no direct expressions to estimate
the statistical uncertainty in free energy differences or expectations
obtained from WHAM.  It is possible to estimate the variances of
expectation averages using a Poisson distribution estimate of the bin
occupancy probabilities~\cite{choderawham}, but these assume that the
underlying free energies are without error, which is not correct.  It
is possible to perform bootstrap sampling on WHAM to generate
estimated variances~\cite{efron}, which in many cases may be useful,
but this is of course true with MBAR as well.

Third, for performing estimates with multidimensional order
parameters, the number of bins required for WHAM increases as
$(1/h)^d$, where $h$ is the spacing required and $d$ is the dimension.
For multidimensional order parameters, MBAR is only limited by the
number of states required to span the multidimensional order parameter
space, since it is bin-free.  

%John, could you explain a bit more here?

Despite these clear theoretical advantages, it is not always
immediately clear what the advantages will be in practical settings.

The one advantage that WHAM can have is a speed advantage.  WHAM only
requires iteration over a fixed number of bins.  With a very large
number of data points, such that the descritization error is
negligible, then the iterative solution of the WHAM equations will be
faster than the iterative solution of the MBAR equations.  However, we
do not usually face the problem of too many data points; instead, we
face the problem of too few data points.  In the data-poor regime,
bins that are sufficiently large to reduce statistical error to
tolerable levels may introduce exactly the sorts of bias seen here.

As a direct demonstration of the difference between WHAM and MBAR, we
compare Alan Grossfield's implementation of WHAM with MBAR for two
situations; the free energy difference of 

% LocalWords:  MBAR alchemical TI Zwanzig IEXP DEXP solute Coulombic Lennard AA
% LocalWords:  Columbic intramolecular Gromacs FFT subsampled subsampling kJ Av
% LocalWords:  resampled resampling resamplings postprocesing Unc solutes py
% LocalWords:  gromacs simtk org MacBook GHz Duo
