\HeaderA{maNormNN}{Intensity and spatial normalization using robust neural networks fitting}{maNormNN}
\keyword{smooth}{maNormNN}
\keyword{robust}{maNormNN}
\begin{Description}\relax
This function normalizes a batch of cDNA arrays by removing the intensity and spatial dependent bias.
\end{Description}
\begin{Usage}
\begin{verbatim}
maNormNN(mbatch,w=NULL,binWidth=3,binHeight=3,model.nonlins=3,iterations=100,nFolds=10,maplots=FALSE,verbose=FALSE) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{mbatch}] A \code{marrayRaw} or \code{marrayNorm} batch of arrays.

\item[\code{w}] Weights to be assigned to each spot. If provided, it should be a vector with the same length as maNspots(mbatch).

\item[\code{binWidth}] Width of the bins in the \eqn{X}{} direction (spot column) in which the 
print tip will be divided in order to account for spatial variation. Max value 
is \code{maNsc(mbatch)}, Min value is 1. However if it is set to a number larger than 
\code{maNsc(mbatch)/2} (so less than two bins in \eqn{X}{} direction) the variable \eqn{X}{} will not 
be used as predictor to estimate the bias.

\item[\code{binHeight}] Height of the bins in the \eqn{Y}{} direction (spot row)in which the 
print tip will be divided in order to account for spatial variation. Max value 
is \code{maNsr(mbatch)}, Min value is 1. However if it is set to a number larger than 
\code{maNsr(mbatch)/2} (so less than two bins in \eqn{Y}{} direction) the variable \eqn{Y}{} will not 
be used as predictor to estimate the bias.

\item[\code{model.nonlins}] Number of nodes in the hidden layer of the neural network model. 

\item[\code{iterations}] The number of iterations at which (if not converged) the training of the neural net will be 
stopped.

\item[\code{nFolds}] Number of cross-validation folds. It represents the number of equal parts in which the data from a 
print tip is divided into: the model is trained on nFolds-1 parts and the bias is estimated for one part at the 
time. Higher values improve the results but increase the computation time. Ideal values are between 5 and 10. 

\item[\code{maplots}] If set to \code{"TRUE"} will produce a \eqn{M-A}{} plot for each slide before and after normalization. 

\item[\code{verbose}] If set to \code{"TRUE"} will show the output of the nnet function which is training the neural
network models. 

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function uses neural networks to model the bias in cDNA data sets.
\end{Details}
\begin{Value}
A \code{marrayNorm} object containing the normalized log ratios. See \code{marrayNorm} 
class for details
\end{Value}
\begin{Author}\relax
Tarca, A.L.
\end{Author}
\begin{References}\relax
A. L. Tarca, J. E. K. Cooke, and J. Mackay. Robust neural networks approach for spatial and
intensity dependent normalization of cDNA data. Bioinformatics. 2004,submitted.\\
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{compNorm}{compNorm}},\code{nnet}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# Normalization of swirl data
data(swirl)
# print-tip, intensity and spatial normalization of the first slide in swirl data set
swirlNN<-maNormNN(swirl[,1])   

#do not consider spatial variations, and display M-A plots before and after normalization
swirlNN<-maNormNN(swirl[,1],binWidth=maNsc(swirl),binHeight=maNsr(swirl),maplots=TRUE)  

\end{ExampleCode}
\end{Examples}

