\HeaderA{SSfol}{First-order Compartment Model}{SSfol}
\keyword{models}{SSfol}
\begin{Description}\relax
This \code{selfStart} model evaluates the first-order compartment
function and its gradient.  It has an \code{initial} attribute that 
creates initial estimates of the parameters \code{lKe}, \code{lKa},
and \code{lCl}.
\end{Description}
\begin{Usage}
\begin{verbatim}
SSfol(Dose, input, lKe, lKa, lCl)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{Dose}] a numeric value representing the initial dose.
\item[\code{input}] a numeric vector at which to evaluate the model.
\item[\code{lKe}] a numeric parameter representing the natural logarithm of
the elimination rate constant.
\item[\code{lKa}] a numeric parameter representing the natural logarithm of
the absorption rate constant.
\item[\code{lCl}] a numeric parameter representing the natural logarithm of
the clearance.
\end{ldescription}
\end{Arguments}
\begin{Value}
a numeric vector of the same length as \code{input}, which is the
value of the expression
\code{Dose * exp(lKe+lKa-lCl) * (exp(-exp(lKe)*input)-exp(-exp(lKa)*input)) / (exp(lKa)-exp(lKe))}.

If all of the arguments \code{lKe}, \code{lKa}, and \code{lCl} are
names of objects, the gradient matrix with respect to these names is
attached as an attribute named \code{gradient}.
\end{Value}
\begin{Author}\relax
Jose Pinheiro and Douglas Bates
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{nls}{nls}}, \code{\LinkA{selfStart}{selfStart}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
Theoph.1 <- Theoph[ Theoph$Subject == 1, ]
SSfol( Theoph.1$Dose, Theoph.1$Time, -2.5, 0.5, -3 )  # response only
lKe <- -2.5; lKa <- 0.5; lCl <- -3
SSfol( Theoph.1$Dose, Theoph.1$Time, lKe, lKa, lCl ) # response and gradient
getInitial(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph.1)
## Initial values are in fact the converged values
fm1 <- nls(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph.1)
summary(fm1)
\end{ExampleCode}
\end{Examples}

