\HeaderA{mergeStates}{Funtion to merge states based on their state means}{mergeStates}
\aliasA{combine.func}{mergeStates}{combine.func}
\aliasA{MergeLevels.new}{mergeStates}{MergeLevels.new}
\aliasA{MergeLevels.old}{mergeStates}{MergeLevels.old}
\keyword{models}{mergeStates}
\begin{Description}\relax
\code{mergeStates} takes the output of a segementation algorithm in
the form of a \code{\LinkA{SegList}{SegList}} and iteratively merges the
states with means closer than a supplied threshold.
\end{Description}
\begin{Usage}
\begin{verbatim}
mergeStates(segList, MergeType = 1, pv.thres=0.0001, ansari.sign=0.01, minDiff = 0.25)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{segList}] Object of class \code{\LinkA{SegList}{SegList}}.

\item[\code{MergeType}] Select either 1 or 2.  1 uses a new merging algorithm developed by
Hanni Willenbrock and Jane Fridlyand.

\item[\code{pv.thres}] Significance threshold for Wilcoxon test for
level merging.  Used when MergeType = 1.
\item[\code{ansari.sign}] Significance threshold for Ansari-Bradley test. Used when MergeType = 1.
\item[\code{minDiff}] The states whose predicted values are less than minDiff
apart are merged into one state and all the predicited values are
recomputed.  Used when MergeType = 2.   

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function is intended to reduce effect of the possible small
magnitude technological artifacts on the structure determination.
\end{Details}
\begin{Value}
A \code{\LinkA{SegList}{SegList}} object is returned with the merged states
stored in the \code{pred} list.
\end{Value}
\begin{Author}\relax
Jane Fridlyand
\end{Author}
\begin{References}\relax
Application of Hidden Markov Models to the analysis of the
array CGH data, Fridlyand et.al., \emph{JMVA}, 2004
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{SegList}{SegList}},
\code{\LinkA{runHomHMM}{runHomHMM}},
\code{\LinkA{runGLAD}{runGLAD}},
\code{\LinkA{runDNAcopy}{runDNAcopy}}
\end{SeeAlso}

