nls.control
Control the Iteration in nls()

Description

Provides a convenient way to set the control argument of nls().

Usage

nls.control(maxiter = 50, tolerance = 1e-05, minFactor = 1/1024, printEval = FALSE, warnOnly = FALSE)

Arguments

maxiter the maximum number of iterations during fitting. The default is 50.
tolerance the tolerance for the relative offset convergence criterion in the algorithm. The default is 1e-05. Note that the convergence test used in nls() is strictly relative: it wants the residual vector to be close to orthogonal to the tangent space of the model. Therefore if the solution to a problem turns out to be a perfect fit (unlikely except in artificial examples), convergence is not guaranteed to be recognized by the algorithm.
minFactor a small negative power of two. If the Gauss-Newton step results in an increase in the sum of squared residuals, the step size is repeated halved until the sum of squares decreases, or until the relative step size is smaller than minFactor. The default is 1/1024.
printEval a logical flag. If TRUE, prints information about the iterations and partial steps. The default is FALSE.
warnOnly a logical flag. If TRUE, if nls() terminates without reaching convergence, it returns the current estimates with a warning, instead of signalling an error. The default is FALSE.

Details

Use the control argument to the function nls() to set several values to control the optimization algorithm. This function may be used to set them instead of using the list function. The advantge is that nls.control ensures that you spell (or abbreviate) the variable names correctly.
Value
returns a list containing components for each of the possible arguments, either the value supplied by the user or the default.
References
Chambers, J. M., and Hastie, T. J. (eds) (1990). Statistical Models in S, Chapter 10, "Nonlinear Models", Pacific Grove, CA.
See Also
nls.
Examples
# Make some fake data
d <- data.frame(X=1:20, Y=round(log2(1:20),1)+1)
# Fit a poor model to the data
nls(Y ~ cbind(1, X^p), start=list(p=0.5), data=d, algorithm="plinear",
    trace=TRUE, control=nls.control(printEval=TRUE, minFactor=2^-24, warnOnly=TRUE))
Package stats version 6.0.0-69
Package Index