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.
1 2 
formula 
This is a modeling formula of the form (as in 
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. 
data 
A data frame containing the data of the variables in the formula. This data may, however, be supplied directly in the parent frame. 
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. 
control 
A list of controls for the algorithm. These are as for 
... 
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. 
wrapnls
first attempts to solve the nonlinear sum of squares problem by using
nlsmnq
, then takes the parameters from that method to call nls
.
An object of type nls.
Special notes, if any, will appear here.
John C Nash <nashjc@uottawa.ca>
Function nls()
, packages optim
and optimx
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  cat("See examples in nlmrtpackage.Rd\n")
## Not run:
cat("kvanderpoel.R test\n")
# require(nlmrt)
x<c(1,3,5,7)
y<c(37.98,11.68,3.65,3.93)
pks28<data.frame(x=x,y=y)
fit0<try(nls(y~(a+b*exp(1)^(c*x)), data=pks28, start=c(a=0,b=1,c=1),
trace=TRUE))
print(fit0)
cat("\n\n")
fit1<nlxb(y~(a+b*exp(c*x)), data=pks28, start=c(a=0,b=1,c=1), trace = TRUE)
print(fit1)
cat("\n\nor better\n")
fit2<wrapnls(y~(a+b*exp(c*x)), data=pks28, start=c(a=0,b=1,c=1),
lower=Inf, upper=Inf, trace = TRUE)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.