\HeaderA{adjustP2}{Adjust model parameter P2}{adjustP2}
\keyword{optimize}{adjustP2}
\begin{Description}\relax
Adjust the calibration model parameter P2 according to the measured intensities
of all clones spotted on the array.
\end{Description}
\begin{Usage}
\begin{verbatim}
adjustP2(RG, parameter, arrayindex = arrayindex, colorindex = colorindex)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{RG}] an \code{RGList} object.
\item[\code{parameter}] a \code{ParameterList} object. 
\item[\code{arrayindex}] integer vector specifying the index of the arrays of whose 
the parameter P2 needed to be adjusted. 
\item[\code{colorindex}] integer vector specifying which color needed to be adjusted.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{RG} is an \code{\LinkA{RGList\_CALIB}{RGList.Rul.CALIB}} object which contains all the
experimental data. 
\code{parameter} is the return result of function \code{\LinkA{estimateParameter}{estimateParameter}.}
\code{arrayindex} is an integer vector. It gives the index of the arrays whose P2 is 
needed to be adjusted.
\code{colorindex} is an integer vector. It gives the color needed to be adjusted.
\code{1} means red P2 and \code{2} means green P2.
\end{Details}
\begin{Value}
It returns a \code{\LinkA{ParameterList}{ParameterList}} object with a adjusted
P2 compared to the input argument \code{parameter}.
\end{Value}
\begin{Note}\relax
The user should decide on which array and which color the adjustment is needed.
Therefore it is important to specify the right array index and color index.
There is no check on this in the function.
\end{Note}
\begin{Author}\relax
Hui Zhao
\end{Author}
\begin{Examples}
\begin{ExampleCode}
# load data: RG and parameter:
data(RG)
data(parameter)

# adjust P2
parameter_new <- adjustP2(RG,parameter,arrayindex=c(1,2),colorindex=c(2,2))
\end{ExampleCode}
\end{Examples}

