# 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 sub-problem is solved by a qr method.

### Usage

1 2 |

### Arguments

`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. |

### Details

`wrapnls`

first attempts to solve the nonlinear sum of squares problem by using
`nlsmnq`

, then takes the parameters from that method to call `nls`

.

### Value

An object of type nls.

### Note

Special notes, if any, will appear here.

### Author(s)

John C Nash <nashjc@uottawa.ca>

### See Also

Function `nls()`

, packages `optim`

and `optimx`

.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
cat("See examples in nlmrt-package.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)
``` |