\HeaderA{normexp.fit}{Fit Normal+Exp Convolution Model to Observed Intensities}{normexp.fit}
\keyword{models}{normexp.fit}
\begin{Description}\relax
Fit normal+exponential convolution model to observed intensities.
The normal part represents the background and the exponential represents the signal intensities.
This function is called by \code{backgroundCorrect} and is not normally called directly by the user.
\end{Description}
\begin{Usage}
\begin{verbatim}
normexp.fit(x, trace=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] numeric vector of (background corrected) intensities
\item[\code{trace}] logical, if \code{TRUE}, tracing information on the progress of the optimization is given.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function uses maximum likelihood estimation to fit a model to the foreground and background intensities.
The model is a $normal(\mu,\sigma^2)+exponential(\alpha)$ convolution model for the background corrected intensities.

This is essentially the same model which is used by \code{bg.correct.rma} in the affy package.
The difference is that the parameters are estimated by maximum likelihood and that the estimated background is subtracted before applying the model-based background.
\end{Details}
\begin{Value}
A list containing the components
\begin{ldescription}
\item[\code{par}] numeric vector giving estimated values of $\mu$, $\log(\sigma)$ and $\log\alpha$
\item[\code{m2loglik}] numeric scalar giving minus twice the log-likelihood
\item[\code{convergence}] integer code indicating successful convergence or otherwise of the optimization. See \code{optim}.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Jeremy Silver and Gordon Smyth
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{normexp.signal}{normexp.signal}}

An overview of background correction functions is given in \code{\LinkA{04.Background}{04.Background}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
f <- c(2,3,1,10,3,20,5,6)
b <- c(2,2,2,2,2,2,2,2)
out <- normexp.fit(f-b)
normexp.signal(out$par, x=f-b)
\end{ExampleCode}
\end{Examples}


