\Header{fdHess}{Finite difference Hessian}
\keyword{models}{fdHess}
\begin{Description}\relax
Evaluate an approximate Hessian and gradient of a scalar function
using finite differences.
\end{Description}
\begin{Usage}
\begin{verbatim}
fdHess(pars, fun, ..., .relStep=(.Machine$double.eps)^(1/3), minAbsPar=0)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{pars}] the numeric values of the parameters at which to evaluate the
function \code{fun} and its derivatives.
\item[\code{fun}] a function depending on the parameters \code{pars} that
returns a numeric scalar.
\item[\code{...}] Optional additional arguments to \code{fun}
\item[\code{.relStep}] The relative step size to use in the finite
differences.  It defaults to the cube root of \code{.Machine\$double.eps}
\item[\code{minAbsPar}] The minimum magnitude of a parameter value that is
considered non-zero.  It defaults to zero meaning that any non-zero
value will be considered different from zero.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function uses a second-order response surface design known as a
Koschal design to determine the parameter values at which the function
is evaluated.
\end{Details}
\begin{Value}
A list with components
\begin{ldescription}
\item[\code{mean}] the value of function \code{fun} evaluated at the
parameter values \code{pars}
\item[\code{gradient}] an approximate gradient
\item[\code{Hessian}] a matrix whose upper triangle containst an approximate Hessian.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Jose Pinheiro \email{jcp@research.bell-labs.com}, Douglas Bates
\email{bates@stat.wisc.edu}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
fdHess(c(12.3, 2.34), function(x) x[1]*(1-exp(-0.4*x[2])))
\end{ExampleCode}
\end{Examples}

