Commit bbf64eda authored by Alberto Ramos's avatar Alberto Ramos

Complete version of the aderrors library

aderrors is a fortran 2008 library for error analysis of MC data with
the following features:

- Exact linear error propagation, even in iterative algorithms
  (i.e. error propagation in fit parameters).
- Handles data from any number of ensembles (i.e. simulations with
  different parameters).
- Support for replicas (i.e. several runs with the same simulation
  parameters).
- Standalone portable implementation without any external
  dependencies.
- Fast computation of autocorrelation functions with the FFT
  package (see http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html).
- Exact determination of gradients and Hessians of arbitrary
  functions.
parents
# aderrors - Error analysis of Monte Carlo data with Automatic Differentiation
`aderrors` is a fortran implementation of the $`\Gamma`$-method for
analysis of Monte Carlo data. It uses Automatic Differentiation to
perform **exact linear error propagation**. It preforms the computation
of gradients and Hessians of arbitrary functions, which allows a
robust and **exact error propagation even in iterative algorithms**.
- [Features](#features)
- [Examples](#examples)
- [Simple analysis of MC data](#simple-analysis-of-mc-data)
- [A complete example](#a-complete-example)
- [A calculator with uncertainties](#a-calculator-with-uncertainties)
- [Installation](#installation)
- [Requirements](#requirements)
- [Instructions](#instructions)
- [Using the library](#using-the-library)
- [Full documentation](#full-documentation)
- [How to cite](#how-to-cite)
## Features
- **Exact** linear error propagation, even in iterative algorithms
(i.e. error propagation in fit parameters).
- Handles data from **any number of ensembles** (i.e. simulations with
different parameters).
- Support for **replicas** (i.e. several runs with the same simulation
parameters).
- Standalone **portable** implementation without any external
dependencies.
- **Fast** computation of autocorrelation functions with the [FFT
package](http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html) (included
in the distribution).
- **Exact** determination of gradients and Hessians of arbitrary
functions.
## Examples
This is just a small collection of examples. Note that the basic data type is
`uwreal`, that is able to handle MC histories and data with
errors. The error is determined by calling the method `uwerr`
on the data type. More examples can be found in the `test` directory
of the distribution. They are explained in the documentation `doc/aderrors.pdf`.
All these examples use the `module simulator` (available in
`test/simulator.f90`) to generate autocorrelated data with
autocorrelation function $`\Gamma(t) = \sum_k \lambda_k
e^{-|t|/\tau_k}`$.
### Simple analysis of MC data
This code performs a simple error analysis of the data with the default
parameters ($`S_{\tau}=4`$ for automatic windowing, no tail added to the
autocorrelation function). The result of the analysis with the
$`\Gamma`$-method is compared with the exact values of the error and
$`\tau_{\rm int}`$ returned by the `module simulator`. This example is
included in the distribution in the file `test/simple.f90`.
```fortran
program simple
use ISO_FORTRAN_ENV, Only : error_unit, output_unit
use numtypes
use aderrors
use simulator
implicit none
integer, parameter :: nd = 20000
type (uwreal) :: x
real (kind=DP) :: data_x(nd), err, ti, tau(5), lam(5)
! Fill arrays data_x(:) with autocorrelated
! data from the module simulator.
tau = (/1.0_DP, 3.0_DP, 4.0_DP, 5.0_DP, 7.34_DP/)
lam = (/1.00_DP, 0.87_DP, 1.23_DP, 0.56_DP, 0.87_DP/)
call gen_series(data_x, err, ti, tau, lam, 0.3_DP)
! Load data_x(:) measurements in variable x. Use
! default settings (Stau=4, texp=0, 1 replica)
x = data_x
! Perform error analysis (optimal window)
call x%uwerr()
! Print results
write(*,'(1A,1I6,1A)')'** Measurements: ', nd, ' ** '
write(*,100)' - Gamma-method: ', x%value(), " +/- ", x%error(), '( tauint: ', &
x%taui(1), " +/- ", x%dtaui(1), ')'
write(*,100)' - Exact: ', 0.3_DP, " +/- ", err, '( tauint: ', ti, " )"
100 FORMAT((2X,1A,1F8.5,1A,1F7.5,5X,1A,1F0.2,1A,1F7.5,1A))
stop
end program simple
```
Running this code gives as output
```
** Measurements: 20000 **
- Gamma-method: 0.29883 +/- 0.04271 ( tauint: 4.13 +/- 0.48344)
- Exact: 0.30000 +/- 0.04074 ( tauint: 3.82 )
```
### A complete example
This example is included in the distribution in the file
`test/complete.f90`. The analysis is performed
for a complicated non-linear function of the two primary
observables. It also uses replica for the MC ensemble labeled 1.
```fortran
program complete
use ISO_FORTRAN_ENV, Only : error_unit, output_unit
use numtypes
use constants
use aderrors
use simulator
implicit none
integer, parameter :: nd = 5000, nrep=4
type (uwreal) :: x, y, z
integer :: iflog, ivrep(nrep)=(/1000,30,3070,900/), i, is, ie
real (kind=DP) :: data_x(nd), data_y(nd/2), err, ti, texp
real (kind=DP) :: tau(4), &
lam_x(4)=(/1.0_DP, 0.70_DP, 0.40_DP, 0.40_DP/), &
lam_y(4)=(/2.3_DP, 0.40_DP, 0.20_DP, 0.90_DP/)
character (len=200) :: flog='history_z.log'
! Fill arrays data_x(:) with autocorrelated
! data from the module simulator. Use nrep replica
tau = (/1.0_DP, 3.0_DP, 12.0_DP, 75.0_DP/)
texp = maxval(tau)
is = 1
do i = 1, nrep
ie = is + ivrep(i) - 1
call gen_series(data_x(is:ie), err, ti, tau, lam_x, 0.3_DP)
is = ie + 1
end do
! Fill data_y(:) with different values of tau also using
! module simulator
forall (i=1:4) tau(i) = real(2*i,kind=DP)
call gen_series(data_y, err, ti, tau, lam_y, 1.3_DP)
! Load data_x(:) measurements in variable x.
! Set replica vector, exponential autocorrelation time
! and ensemble ID.
x = data_x
call x%set_id(1)
call x%set_replica(ivrep)
call x%set_texp(texp)
! Load data_y(:) measurements in variable y
y = data_y
call y%set_id(2)
! Exact, transparent error propagation
z = sin(x)/(cos(y) + 1.0_DP)
! Attach tail in ensemble with ID 1 when signal in the
! normalized auto-correlation function equals its error
call z%set_dsig(1.0_DP,1)
! Set Stau=3 for automatic window in ensemble with ID 2
call z%set_stau(3.0_DP,2)
! Perform error analysis (tails, optimal window,...)
call z%uwerr()
! Print results and output details to flog
write(*,'(1A,1F8.5,1A,1F8.5)')'** Observable z: ', z%value(), " +/- ", z%error()
do i = 1, z%neid()
write(*,'(3X,1A,1I3,3X,1F5.2,"%")',advance="no")'Contribution to error from ensemble ID', &
z%eid(i), 100.0_DP*z%error_src(i)
write(*,'(2X,1A,1F0.4,1A,1F8.4,1A)')'(tau int: ', z%taui(i), " +/- ", z%dtaui(i), ")"
end do
open(newunit=iflog, file=trim(flog))
call z%print_hist(iflog)
close(iflog)
stop
end program complete
```
Running this code gives as output
```
** Observable z: 0.24426 +/- 0.05374
Contribution to error from ensemble ID 1 83.93% (tau int: 5.8333 +/- 2.0772)
Contribution to error from ensemble ID 2 16.07% (tau int: 2.5724 +/- 0.5268)
```
The file `history_z.log` contains the MC histories, normalized
autocorrelation functions and $`\tau_{\rm int}`$. The format is
a simple text file: it can be processed by shell scripts
(see `tools/plot/plot_hist.sh`) to produce the following graphics.
<img src="plots/ID1-hist.png" alt="ID1-hist" width="800"/>
</br>
<img src="plots/ID1-auto.png" alt="ID1-hist" width="400"/>
<img src="plots/ID1-taui.png" alt="ID1-hist" width="400"/>
### A calculator with uncertainties
The module also handles simple data with errors (i.e. **not** a MC
history). This is extremely useful since in many occasions we have to
use data from statistically independent sources where only the central
value and the error is available.
With the module `aderrors` these kind of data in handled
transparently, just as if it were another ensemble (see `test/calculator.f90`).
```fortran
program calculator
use aderrors
implicit none
type (uwreal) :: x, y, z, t
x = (/1.223_8, 0.012_8/) ! x = 1.223 +/- 0.012
y = sin(2.0_8*x)
z = 1.0_8 + 2.0_8 * sin(x)*cos(x)
t = z - y
call t%uwerr()
write(*,'(1A,1F18.16,1A,1F18.16)')'Exactly one: ', t%value(), " +/- ", t%error() ! 1.0 +/- 0.0
stop
end program calculator
```
Running this code gives as output
```
Exactly one: 1.0000000000000000 +/- 0.0000000000000000
```
## Installation
### Requirements
The code is strict `fortran 2008` compliant. Any compiler that
supports this standard can be used. The code has been tested with
`gfortran 6.X`, `gfortran 7.X`, `gfortran 8.X`, `intel fortran 17`,
`intel fortran 18`.
Note that `gfortran 4.X` and `gfortran 5.X` do not support
`submodules` (part of the `fortran 2008` standard). This code will not
work whith these versions.
### Instructions
1. Download or clone the repository.
1. Edit the `Makefile` in the `build` directory. Change the compiler
command/options (variables `FC` and `FOPT`).
1. Compile the library with `gmake`.
1. Optionally build/run the test codes with `gmake test`. Executabes will
be placed in the `test` directory.
1. If preferred, move the contents of the `include` and `lib`
directories somewhere else.
### Using the library
1. Compile your programs with `-I <dir>/include`.
1. Link your programs with the `-L <dir>/lib` and `-laderr` options.
## Full documentation
Look into the `doc/aderrors.pdf` file.
## How to cite
If you use this package for a scientific publication, please cite the
original work ...
INC = ./include
DOBJ = ./obj
FC = gfortran6
FOPT = -J$(INC) -O3 --fast-math -march=native -ftree-vectorize \
-funroll-loops -std=f2008
#
# For intel fortran try
#
#FC = ifort
#FOPT = -module $(INC) -O2 -stand f08
FFLAGS = $(FOPT)
MISC = numtypes.o constants.o time.o nonnum.o bdio.o fourier.o
LINKED = linked_list.o linked_list_basic.o
ADERRORS = aderrors.o aderrors_arith.o aderrors_cf.o aderrors_func.o \
aderrors_io.o aderrors_cov.o aderrors_op.o aderrors_diff.o \
aderrors_darith.o
OBJWP = $(MISC) $(RANDOM) $(LINKED) $(ADERRORS)
OBJ = $(foreach ob,$(OBJWP),$(DOBJ)/$(ob))
VPATH=../src/misc:../src/aderrors:../src/linked_list
.SUFFIXES: .f90 .o .x
.PHONY: clean, all, lib, test
$(DOBJ)/%.o: %.f90
$(FC) $(FFLAGS) -c $< -o $@ -I$(INC)
%.x: %.f90 $(OBJ)
$(FC) $(FFLAGS) ../test/simulator.f90 $< -o$@ -L./lib/ -I$(INC) -laderr
all: lib
test: lib ../test/calculator.x ../test/uwerr.x ../test/simple.x \
../test/newton.x ../test/derived.x ../test/multi.x \
../test/hessian.x ../test/complete.x ../test/newton_grad.x
lib: $(OBJ)
ar rcs ./lib/libaderr.a $(DOBJ)/*.o
# rm *.o
clean:
rm obj/*.o
rm include/*.mod
rm include/*.smod
rm lib/libaderr.a
# Ignore everything in this directory
*
# Except this file
!.gitignore
# Ignore everything in this directory
*
# Except this file
!.gitignore
# Ignore everything in this directory
*
# Except this file
!.gitignore
\providecommand{\href}[2]{#2}\begingroup\raggedright\begin{thebibliography}{1}
\bibitem{aderrors-mod}
{Ramos, Alberto}, ``{\tt aderrors}: Error analysis of monte carlo data with
automatic differentiation,'' 2018.
\newblock \url{https://gitlab.ift.uam-csic.es/alberto/aderrors}.
\bibitem{fft-package}
{Ooura, Takuya}, ``{FFT} package,'' 1996.
\newblock \url{http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html}.
\bibitem{wiki:ad}
{Wikipedia contributors}, ``Automatic differentiation --- {W}ikipedia{,} the
free encyclopedia,'' 2018.
\newblock \url{https://en.wikipedia.org/wiki/Automatic_differentiation}.
[Online; accessed 22-June-2018].
\bibitem{web:bdio}
{Tomasz Korzec and Hubert Simma}, ``binary data i/o,'' 2014.
\newblock \url{http://www.bdio.org/}.
\end{thebibliography}\endgroup
\documentclass[11pt,twoside]{article}
\bibliographystyle{utphys}
\usepackage{feyn}
\setlength{\textwidth}{15cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{1cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\textheight}{24cm}
\advance \headheight by 3.0truept
\newcommand{\chk}{\color{green}{\texttt{CHECKED!}}}
\newcommand{\att}{\color{red}{\texttt{ATTENTION!}}}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{sectsty}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{lastpage}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{wrapfig}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,urlcolor=blue,linktocpage}
\usepackage[toc]{multitoc}
\renewcommand*{\multicolumntoc}{1}
\usepackage{float}
\usepackage{minted}
\usemintedstyle{tango}
\allsectionsfont{\sffamily}
\begin{document}
\begin{flushleft}
{\huge \textsf{\texttt{aderrors}: Error analysis of Monte Carlo data
with
\phantom{\texttt{aderrors}: }Automatic Differentiation.}}\
\noindent\rule[-1ex]{\textwidth}{1pt}
\vspace{0.2cm}
\small{Alberto ramos \texttt{<alberto.ramos@maths.tcd.ie>}}
\end{flushleft}
\begin{abstract}
\noindent
\texttt{aderrors} is a \texttt{fortran 2008} library for error analysis of MC
data. It uses the
$\Gamma$-method together with techniques of automatic differentiation to provide
a robust, efficient, portable, transparent and open source module for
the analysis of Monte Carlo data~\cite{aderrors-mod}.
\end{abstract}
\tableofcontents
\section{Features}
\begin{itemize}
\item \textbf{Exact} linear error propagation, even in iterative
algorithms (i.e. error propagation in fit parameters) thanks to
Automatic Differentiation.
\item Handles data from \textbf{any number of ensembles} (i.e. simulations with
different parameters).
\item Support for \textbf{replicas} (i.e. several runs with the same simulation
parameters).
\item Standalone \textbf{portable} implementation without any external
dependencies.
\item \textbf{Fast} computation of autocorrelation functions with the
FFT package~\cite{fft-package} (included in the distribution).
\item \textbf{Exact} determination of gradients and Hessians of
arbitrary functions.
\end{itemize}
\section{Installing and linking with the library}
\subsection{Installing}
\begin{enumerate}
\item Download or clone the repository at~\cite{aderrors-mod}.
\item Edit the \texttt{Makefile} in the \texttt{build}
directory. Change according to your needs. Usually only the compiler
command/options (variables \texttt{FC} and \texttt{FOPT}) have to be
changed.
\item Compile the library with \texttt{gmake}.
\item Optionally build/run the test codes with \texttt{gmake test} . Executabes will
be placed in the \texttt{test} directory.
\item If preferred, move the contents of the \texttt{include} and \texttt{lib}
directories somewhere else.
\end{enumerate}
\subsection{Using the library}
\begin{itemize}
\item Compile your programs with \texttt{-I <dir>/include}.
\item Link your programs with the \texttt{-L <dir>/lib} and \texttt{-laderr} options.
\end{itemize}
\section{Example usage}
This is a collection of simple examples on the usage of the
\texttt{module aderrors}. Note that the basic data type is
\texttt{uwreal}, that is able to handle MC histories and data with
errors. The error is determined by calling the method \texttt{uwerr}
on the data type.
In these examples we use the \texttt{module simulator}
(\texttt{test/simulator.f90}) to generate autocorrelated data.
\subsection{Simple analysis of MC data}
%\begin{wrapfigure}{r}{0.3\textwidth}
% \centering
% \includegraphics[width=0.49\textwidth]{fig/data.pdf}
% \caption{Monte-Carlo history of some observable}
% \label{fig:obs1}
%\end{wrapfigure}
Estimating the value and statistical error of a quantity given
some MC data is really very simple. The following example is available
in \texttt{test/simple.f90}.
\begin{minted}[linenos,frame=lines]{fortran}
program simple
use numtypes
use aderrors
use simulator
implicit none
integer, parameter :: nd = 20000
type (uwreal) :: x
real (kind=DP) :: data_x(nd), err, ti, tau(5), lam(5)
! Fill array data_x(:) with autocorrelated
! data from the module simulator.
tau = (/1.0_DP, 3.0_DP, 4.0_DP, 5.0_DP, 7.34_DP/)
lam = (/1.00_DP, 0.87_DP, 1.23_DP, 0.56_DP, 0.87_DP/)
call gen_series(data_x, err, ti, tau, lam, 0.3_DP)
! Load data_x(:) measurements in variable x. Use
! default settings (Stau=4, texp=0, 1 replica)
x = data_x
! Perform error analysis (optimal window)
call x%uwerr()
! Print results and compare with exact values
write(*,'(1A,1I6,1A)')'** Measurements: ', nd, ' ** '
write(*,100)' - Gamma-method: ', x%value(), " +/- ", x%error(), '( tauint: ', &
x%taui(1), " +/- ", x%dtaui(1), ')'
write(*,100)' - Exact: ', 0.3_DP, " +/- ", err, '( tauint: ', ti, " )"
100 FORMAT((2X,1A,1F8.5,1A,1F7.5,5X,1A,1F0.2,1A,1F7.5,1A))
stop
end program simple
\end{minted}
Note that we only need to load the MC data in a \texttt{uwreal} data
type and call \texttt{uwerr()} to determine the mean value and error.
\subsection{Complicated derived observables}
Imagine that we have the MC data of some observable $X$. We are
interested in a complicated quantity
\begin{equation}
f(\langle X \rangle) = \frac{\sin(\langle X \rangle)\, \cos (\langle X \rangle^2)}
{1+ \langle X \rangle^4}\,.
\end{equation}
The question is what is the mean value and the error in $f(\langle X
\rangle)$? The example shows how to do such a computations (\texttt{test/derived.f90})
\begin{minted}[linenos,frame=lines]{fortran}
program derived
use ISO_FORTRAN_ENV, Only : error_unit, output_unit
use numtypes
use aderrors
use simulator
implicit none
integer, parameter :: nd = 20000
type (uwreal) :: x, y
real (kind=DP) :: data_x(nd), err, ti, tau(5), lam(5)
! Fill arrays data_x(:) with autocorrelated
! data from the module simulator.
tau = (/1.0_DP, 3.0_DP, 4.0_DP, 5.0_DP, 7.34_DP/)
lam = (/1.00_DP, 0.87_DP, 1.23_DP, 0.56_DP, 0.87_DP/)
call gen_series(data_x, err, ti, tau, lam, 0.3_DP)
! Load data_x(:) measurements in variable x. Use
! default settings (Stau=4, texp=0, 1 replica)
x = data_x
! Exact, transparent error propagation
y = sin(x)*cos(x**2)/(1.0_DP+x**4)
! Perform error analysis (optimal window)
call y%uwerr()
! Print results
write(*,'(1A,1I6,1A)')'** Measurements: ', nd, ' ** '
write(*,100)' - Gamma-method: ', y%value(), " +/- ", y%error(), '( tauint: ', &
y%taui(1), " +/- ", y%dtaui(1), ')'
100 FORMAT((2X,1A,1F8.5,1A,1F7.5,5X,1A,1F0.2,1A,1F7.5,1A))
stop
end program derived
\end{minted}
This computation requires to determine the
derivative of the function $f(x)$. This derivative is determined
using \emph{automatic differentiation}~\cite{wiki:ad}. This method
avoids the numerical evaluation of the derivative by some variant of
the finite difference approach, or by some stochastic evaluation of
the derivative (as is done in jacknife/bootstrap). Making a long story
short, the derivative of $f(x)$ is determined exactly (up to machine
precision).
\subsection{A calculator with uncertainties}
The \texttt{module aderrors} does not only handle full MC
histories, but also regular variables with errors. Consider the next
example (\texttt{test/calculator.f90})
\begin{minted}[linenos,frame=lines]{fortran}
program calculator
use numtypes
use aderrors
implicit none
type (uwreal) :: x, y, z, t
x = (/1.223_DP, 0.012_DP/) ! x = 1.223 +/- 0.012
y = sin(2.0_DP*x)
z = 1.0_DP + 2.0_DP * sin(x)*cos(x)
t = z - y
call t%uwerr()
write(*,'(1A,1F18.16,1A,1F18.16)')'Exactly one: ', &
t%value(), " +/- ", t%error() ! 1.0 +/- 0.0
stop
end program calculator
\end{minted}
Note that not only the mean value of \texttt{t} is one, but also the
error is zero (i.e. the
correlation between different variables is correctly taken into
account).
This is a trivial example, but the \texttt{module aderrors}
handles correctly and automatically the correlations between different
observables from the same MC chain (i.e. proton and pion masses
measured in a ensemble).
\subsection{Combining MC chains}
In many cases we have to estimate quantities that depend on several
MC ensembles. This case is handled transparently by just identifying
the ensemble where each primary observable was measured with an
integer ID.
The following example (\texttt{test/multi.f90}) combines in a derived
observable data from different ensembles and also a simple quantity
with uncertainties (these are treated as independent ensembles).
\begin{minted}[linenos,frame=lines]{fortran}
program multi
use ISO_FORTRAN_ENV, Only : error_unit, output_unit
use numtypes
use aderrors
use simulator
implicit none
integer, parameter :: nd = 200000
real (kind=DP) :: data_x(nd), data_y(nd), err, ti, tau(5), lam(5), texp
type (uwreal) :: x, y, z, t
integer :: i
! Fill array data_x(:) with autocorrelated data
! from the module simulator. Save slowest mode in texp
tau = (/1.0_DP, 3.0_DP, 4.0_DP, 5.0_DP, 73.4_DP/)
texp = maxval(tau)
lam = (/1.00_DP, 0.87_DP, 1.23_DP, 0.56_DP, 0.087_DP/)
call gen_series(data_x, err, ti, tau, lam, 0.3_DP)
! Fill array data_y(:) with autocorrelated
! data from the module simulator.
tau = (/1.4_DP, 2.4_DP, 1.8_DP, 5.1_DP, 7.14_DP/)
lam = (/2.00_DP, 0.85_DP, 1.33_DP, 2.56_DP, 1.87_DP/)
call gen_series(data_y, err, ti, tau, lam, 0.3_DP)
! Load data_x(:) in variable x and set ensemble id to 1.
! Set exponential autocorrelation time to add tail
x = data_x
call x%set_id(1)
call x%set_texp(texp)
! Set name of ensemble 1
i = aderr_new_id("Ensemble X", 1)
! Load data_y(:) in variable x and set ensemble id to 2
y = data_y
call y%set_id(2)
! Set name of ensemble 2
i = aderr_new_id("Ensemble Y", 2)
! Observable z is just a variable with error.
! Treat as another ensemble with id 3
z = (/3.23_DP, 0.23_DP/) ! z = 3.23(23)
call z%set_id(3)
! Set name of ensemble
i = aderr_new_id("Variable z with errors", 3)
! Exact, transparent error propagation.
t = z*x/y - y/(z*x)
! Use Stau=1.75 for ensemble with ID 2
call t%set_stau(1.75_DP,2)
! Error analysis (optimal window, tails, ...)
call t%uwerr()
write(*,*)"Result: ", t%value(), " +/- ", t%error()
do i = 1, t%neid()
write(*,200)trim(t%error_name(i)), &
' contribution to error: ', t%error_src(i)*100., '%'
end do
200 FORMAT(1A22,1A,5X,1F6.2,1A)
stop
end program multi
\end{minted}
This code produces the flowing output
\begin{verbatim}
Result: 2.6486091631414594 +/- 0.38165436636532096
Variable z with errors contribution to error: 38.34%
Ensemble X contribution to error: 10.64%
Ensemble Y contribution to error: 51.01%
\end{verbatim}
Practical lessons from this example:
\begin{itemize}
\item The routine \texttt{aderr\_new\_id}, stores in a database the ID
of a MC chain and an identification string.
\item Independent ensembles are identified by
assigning to the primary observables an integer ensemble ID.
\item By default all observables are assumed to derive from a common
ensemble with id=-1.