\HeaderA{fit.model}{Fitting a heterogneous HMM to the log2 ratios on a particular chromosome.}{fit.model}
\aliasA{run.nelder}{fit.model}{run.nelder}
\keyword{models}{fit.model}
\begin{Description}\relax
This function fits five homogeneous HMMs to the log2 ratios on a particular chromosome. It then uses either the
AIC or BIC to determine which of the five models is optimal before using a scaled version of the Viterbi algorithm to assign clones to states with the
same underlying copy number.
\end{Description}
\begin{Usage}
\begin{verbatim}
fit.model(sample, chrom, dat, datainfo = clones.info, useCloneDists = TRUE, covariates,
aic = TRUE, bic = FALSE, delta = 1, var.fixed=FALSE, epsilon = 1e-06,
numiter = 30000)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{sample}] If there are multiple samples, the number of the sample to be segmented 
\item[\code{chrom}] The chromosome on which the segmentation is to be carried out on 
\item[\code{dat}] The log2 ratios obtained from the clones located on that chromosome 
\item[\code{datainfo}] A dataframe containing information about the clones
on that chromosome (name, chromosome and location (in Mbs)) 
\item[\code{useCloneDists}] Boolean stating whether the distance between
clones should be incorportated into the HMM.  If false then the HMM
become homogeneous.
\item[\code{covariates}] A matrix contianing the covariate information for the clones located on the chromosome to be segmented. It should have length one less
than the number of clones as covariate information is not used when segmenting the first clone on the chromosome. 
\item[\code{aic}] Set to true if you want to use the aic. This is the
default.  Only one of aic and bic should be set to true.
\item[\code{bic}] Set to true if you want to use the bic.
\item[\code{delta}] A parameter to be set if you want to use the BIC 
\item[\code{var.fixed}] Logical variable - TRUE if you want to tie the
variance to be the same across all states. Defaults to FALSE 
\item[\code{epsilon}] .
\item[\code{numiter}] Number of iterations to be used in the
optimization alogithm.
\end{ldescription}
\end{Arguments}
\begin{Value}
The output is in the same format as that obtained when the nlm function is applied.
\end{Value}
\begin{Author}\relax
John Marioni and Mike Smith
\end{Author}

