Hi, I am using the nls function and it stops because the number of iterations exceeded 50, but i used the nls.control argument to allow for 500 iterations. Do you have any idea why it's not working? fm1 <- nls(npe ~ SSgompertz(npo, Asym, b2, b3), data=f,control=nls.control(maxiter=500)) Error in nls(y ~ exp(-b2 * b3^x), data = xy, algorithm = "plinear", start = c(b2 = pars[["b1"]], : number of iterations exceeded maximum of 50 Thanks for your help, Cheers, Karine.
(no subject)
3 messages · Karine HEERAH, Uwe Ligges, S Ellison
2 days later
Please read the posting guide and use a sensible subject line, tell us about the R version you are using, and add a *reproducible* example. We get: Error in nls(npe ~ SSgompertz(npo, Asym, b2, b3), data = f, control = nls.control(maxiter = 500)) : object 'f' not found Best, Uwe Ligges
On 04.01.2013 15:52, Karine HEERAH wrote:
Hi, I am using the nls function and it stops because the number of iterations exceeded 50, but i used the nls.control argument to allow for 500 iterations. Do you have any idea why it's not working? fm1 <- nls(npe ~ SSgompertz(npo, Asym, b2, b3), data=f,control=nls.control(maxiter=500)) Error in nls(y ~ exp(-b2 * b3^x), data = xy, algorithm = "plinear", start = c(b2 = pars[["b1"]], : number of iterations exceeded maximum of 50 Thanks for your help, Cheers, Karine.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
1 day later
I am using the nls function and it stops because the number of iterations exceeded 50, but i used the nls.control argument to allow for 500 iterations. Do you have any idea why it's not working?
Not entirely. But I do see in the code for SSgompertz that SSgompertz calls nls _without_ specifying maxiter. So I suspect the error may be coming from the selfstart step which is ignoring your control argument.
You could check that by adding trace=TRUE to the nls call; I suspect you may see no iterations at all if the self-start fails before nls itself gets going.
If that's so, the easiest way I can see round that (barring alrternative packages I've not heard of) is to copy the SSgompertz code to a text file (say 'SSgompertz' at the command line without () to see the code), create your own SSgompertz function from it, add a big maxiter in its internal call and use your version.
Failing that, use good starting parameters (usually I fool around with plots until something looks close enough to at least start) for a roll-your-own gompertz model.
S Ellison
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}