\HeaderA{findSegments}{Fit a piecewise constant curve to a sequence of numbers  --
OBSOLETE, please use function segment instead.}{findSegments}
\keyword{manip}{findSegments}
\begin{Description}\relax
This function is only here for backward compatibility - please use
\code{\LinkA{segment}{segment}}.

The function fits a piecewise constant curve to a sequence of numbers
using a simple least squares cost function and the dynamic programming
algorithm described by Picard et al. (see reference).
\end{Description}
\begin{Usage}
\begin{verbatim}
findSegments(x, maxcp, maxk, verbose=TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Numeric (real) vector.
\item[\code{maxcp}] Integer (length 1): maximum number of segments (= 1 + maximum
number of change points).
\item[\code{maxk}] Integer (length 1): maximum length of a segment.
\item[\code{verbose}] Logical: if this parameter has a positive
value, various diagnostic output is printed.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The complexity of the algorithm is 
\code{length(x)*maxk} in memory and
\code{length(x)*maxk*maxcp} in time.
\end{Details}
\begin{Value}
An object of class \code{"segmentation"}
A list with elements
\begin{ldescription}
\item[\code{J}] likelihood criterion
\item[\code{th}] matrix of segment start points
\item[\code{dat}] the data used for the segmentation
\item[\code{call}] the function call
\end{ldescription}
.

See the vignette, and
the paper cited below for details.
\end{Value}
\begin{Note}\relax
This function is depracated and replaced by function
\code{segment}, but still included for backward compability.
\end{Note}
\begin{Author}\relax
W. Huber \email{huber@ebi.ac.uk}, Joern Toedling
\email{toedling@ebi.ac.uk}
\end{Author}
\begin{References}\relax
A statistical approach for CGH microarray data analysis.
Franck Picard, Stephane Robin, Marc Lavielle, Christian Vaisse,
Gilles Celeux, Jean-Jacques Daudin,
Rapport de recherche No. 5139, Mars 2004,
Institut National de Recherche en Informatique et en Automatique (INRIA),
ISSN 0249-6399.
The code of this function is based on the Matlab
implementation presented at  
\url{http://www.inapg.fr/ens_rech/mathinfo/recherche/mathematique/outil.html},
but it has evolved.
\end{References}
\begin{Examples}
\begin{ExampleCode}
 x = rep( sin((0:4)/2*pi), each=3) + rnorm(3*5, sd=0.1)
 res = findSegments(x, maxcp=6, maxk=15)
\end{ExampleCode}
\end{Examples}

