[R] nls.control: increasing number of iterations

From: Martin Biuw <emb7_at_st-andrews.ac.uk>
Date: Fri 03 Jun 2005 - 05:05:28 EST


Hello,
I'm using the nls function and would like to increase the number of iterations. According to the documentation as well as other postings on R-help, I've tried to do this using the "control" argument:

nls(y ~ SSfpl(x, A, B, xmid, scal), data=my.data, control=nls.control(maxiter=200))

but no matter how much I increase "maxiter", I get the following error message:

Error in nls(y ~ cbind(1, 1/(1 + exp((xmid - x)/exp(lscal)))), data = xy, :

        number of iterations exceeded maximum of 50

The second line here suggests that the maximum number of iterations is still 50, despite changing the "control" argument. Also, increasing "maxiter" to something silly, like 50000, doesn't seem to increase the process time, which made me a bit suspicious that I'm not giving the right statement to the "control" argument. Or is the function indeed using the increased number of "maxiter", while the error message remains the same rather than reflecting the requested change to nls.control?

I should say that nls converges without increasing maxiter when I use the full dataset, and it is only when I use a smaller subset that the error occurs, possibly due to noisy data. But I would very much appreciate if someone could clarify whether the error message is wrong or if my statement to the "control" argument is wrong.

Thanks very much in advance,
Martin

-- 
Dr Martin Biuw
NERC Postdoctoral research fellow
Sea Mammal Research Unit
Gatty Marine Laboratory
University of St Andrews
St Andrews, Fife KY16 8LB
Scotland
Ph: +44-(0)1334-462677
Fax: +44-(0)1334-462632
www: http://www.smru.st-and.ac.uk

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Jun 03 04:05:11 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:21 EST