Nash variant of Marquardt nonlinear least squares solution via qr linear solver.
Description
Given a nonlinear model expressed as an expression of the form lhs ~ formula_for_rhs and a start vector where parameters used in the model formula are named, attempts to find the minimum of the residual sum of squares using the Nash variant (Nash, 1979) of the Marquardt algorithm, where the linear subproblem is solved by a qr method.
Usage
1 2 
Arguments
resfn 
A function that evaluates the residual vector for computing the elements of
the sum of squares function at the set of parameters 
jacfn 
A function that evaluates the Jacobian of the sum of squares function, that is, the matrix of partial derivatives of the residuals with respect to each of the parameters. If NULL (default), uses an approximation. ?? put in character form as in optimx?? The Jacobian must be returned as the attribute "gradient" of this function,
allowing 
start 
A named parameter vector. For our example, we could use
start=c(b1=1, b2=2.345, b3=0.123)

trace 
Logical TRUE if we want intermediate progress to be reported. Default is FALSE. 
lower 
Lower bounds on the parameters. If a single number, this will be applied to all parameters. Default Inf. 
upper 
Upper bounds on the parameters. If a single number, this will be applied to all parameters. Default Inf. 
maskidx 
Vector if indices of the parameters to be masked. These parameters will NOT be altered
by the algorithm. Note that the mechanism here is different from that in 
data 
Data frame of variables used by resfn and jacfn to compute the required residuals and Jacobian. 
control 
A list of controls for the algorithm. These are:

... 
Any data needed for computation of the residual vector from the expression rhsexpression  lhsvar. Note that this is the negative of the usual residual, but the sum of squares is the same. It is not clear how the dot variables should be used, since data should be in 'data'. 
Details
nlfb
attempts to solve the nonlinear sum of squares problem by using
a variant of Marquardt's approach to stabilizing the GaussNewton method using
the LevenbergMarquardt adjustment. This is explained in Nash (1979 or 1990) in
the sections that discuss Algorithm 23.
In this code, we solve the (adjusted) Marquardt equations by use of the
qr.solve()
. Rather than forming the J'J + lambda*D matrix, we augment
the J matrix with extra rows and the y vector with null elements.
Value
A list of the following items
coefficients 
A named vector giving the parameter values at the supposed solution. 
ssquares 
The sum of squared residuals at this set of parameters. 
resid 
The residual vector at the returned parameters. 
jacobian 
The jacobian matrix (partial derivatives of residuals w.r.t. the parameters) at the returned parameters. 
feval 
The number of residual evaluations (sum of squares computations) used. 
jeval 
The number of Jacobian evaluations used. 
Note
Special notes, if any, will appear here.
Author(s)
John C Nash <nashjc@uottawa.ca>
References
Nash, J. C. (1979, 1990) _Compact Numerical Methods for Computers. Linear Algebra and Function Minimisation._ Adam Hilger./Institute of Physics Publications
others!!
See Also
Function nls()
, packages optim
and optimx
.
Examples
1  cat("See examples in nls14package.Rd\n")
