[R] nls

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Feb 10 10:33:03 CET 2003


Don't use nls for exact fits, as that's not what it is intended for, and
you are trying to achieve a fit to machine accuracy with rounding errors.

You will find several discussions of this in the archives.

On Mon, 10 Feb 2003, Gregory BENMENZER wrote:

> I want to estimate parameters of the model y=a/x with x=1:10 and y=3/x.
> I tested the NLS function.
>
> Could you tell me why it doesn't converge ?
>
> Regards,
>
> Grégory Benmenzer
>
> > x=1:10
> > y=3/x
> > nls(y~a/x, start=list(a=2), control=nls.control(maxiter=100))
> Error in nls(y ~ a/x, start = list(a = 2), control = nls.control(maxiter = 100)) :
>         number of iterations exceeded maximum of 100

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list