\documentclass{paper}
\usepackage{color,alltt,framed,fancybox}
\usepackage{amsmath}
\usepackage{amsthm}
%%%%%%%%%% Start TeXmacs macros
\newcommand{\nocomma}{}
\newcommand{\tmstrong}[1]{\textbf{#1}}
\newcommand{\tmtextsc}[1]{{\scshape{#1}}}
\newcommand{\tmtexttt}[1]{{\ttfamily{#1}}}
\newenvironment{itemizeminus}{\begin{itemize} \renewcommand{\labelitemi}{$-$}\renewcommand{\labelitemii}{$-$}\renewcommand{\labelitemiii}{$-$}\renewcommand{\labelitemiv}{$-$}}{\end{itemize}}
\newenvironment{tmparsep}[1]{\begingroup\setlength{\parskip}{#1}}{\endgroup}
\definecolor{gray}{rgb}{0.75,0.75,0.75}
%\definecolor{shadecolor}{rgb}{1.0,0.5,0.5}
\definecolor{brown}{rgb}{0.5,0.25,0.0}
\definecolor{shadecolor}{rgb}{0.8,1,0.8}
%%%%%%%%%% End TeXmacs macros

\begin{document}

\title{BaTMon - Bayes Test for Monotonicity}
\subtitle{User Manual}
\author{}
\maketitle



\section*{Introduction}

This note present the code associated with the article \cite{Salomond13}



\section*{Contents}

You should find in the folder
\begin{description}
  \item[\tmtexttt{batmon.py} ] A python script that run the test on
  Global Warming Data
  
  \item[\tmtexttt{entries.py} ] A python script that specifies
  \begin{itemize}
    \item The number of draws from the MCMC sampler
    
    \item The path to the dataset
  \end{itemize}
  \item[\tmtexttt{data.txt }] The Global Warming Data with rescaled date
  adapted from {\cite{Jones11}}
  \item[\tmtexttt{data2.txt }] Simulated data from the model 
  $$
  y_i = (i/n)^2 + \mathcal{N}(0,0.01) 
  $$
  
\end{description}

\section*{Start-up Guide}

\subsection*{Installation }

This program is coded in python. It also require some additional packages :
\begin{itemizeminus}
  \item \tmtexttt{numpy, scipy} usually package as python-numpy and
  python-scipy. See http://numpy.scipy.org/
  
  \item \tmtexttt{Rpy} is require for the graph, but that can easilly be
  desable. 
\end{itemizeminus}


Once you have all this installed, you can run the code on the test dataset \texttt{data2.txt} to try if everything works fine. To do so lauch the program from the root
folder in a terminal :

\begin{snugshade}
\begin{alltt}
python Bayes_test.py
\end{alltt}
\end{snugshade}
This should take less than a minute.
\subsection*{Performing the test on your data}

\subsubsection*{Dataset format}

The dataset has to be a \tmtexttt{.txt} file with first column the design
points and second column the data points. The file should contain no header
nor column names. You can specify the value separator in the next section.
Note that this code is adapted to fixed design regresison with design point
$x_i = i / n \nocomma \nocomma, i = 0, \ldots, n - 1$.

\subsubsection*{Performing the test}

To perform the test on your data, you just have to change the code line 3 of
the \tmtexttt{entries.py} script

\begin{snugshade}
\begin{alltt}
dat = genfromtxt('path-to-your-dataset.txt',delimiter=' ')
\end{alltt}
\end{snugshade}

\shadowbox{
\begin{minipage}{0.9\textwidth}


Note that this code test for a monotone
{\tmstrong{non-decreasing}} regression function. To test monotone
non-increasing function, you can ether replace the \tmtexttt{-1.0} by
\tmtexttt{1.0} in the definition of $y$ (line 34 in the \tmtexttt{entries.py}
file) or take minus your data. 
\end{minipage}
}





\subsection*{Reading the output }

The output is typically of this form.
\begin{snugshade}
\begin{alltt}
 0.99999  
 H0 rejected, the function is not monotone
\end{alltt}
\end{snugshade}
The first line is the posterior probability $\pi \left( H \left( \omega, k
\right) > M_n^k \left| Y^n \right. \right)$, the second line gives the result
of the test.


\begin{thebibliography}{2}
  \bibitem[1]{Jones11}P.D.~Jones, D.E.~Parker, T.J.~Osborn and and~K.R.
  Briffa.{\newblock} Global and hemispheric temperature anomalies, land and
  marine instrumental records.{\newblock} 2011.{\newblock}
  
	\bibitem[2]{Salomond13}Salomond, J.-B. (2013).
	\newblock {Adaptive Bayes test for monotonicity}.
	\newblock {\em ArXiv e-prints}. {\newblock}
\end{thebibliography}

\end{document}
