[R] number of iteration s exceeded maximum of 50

Douglas Bates bates at stat.wisc.edu
Sun Jun 18 14:15:08 CEST 2006


On 6/16/06, Leaf Sun <leaflovesun at yahoo.ca> wrote:
> Sorry, I thought it was a straightforward question inside which I was stuck .
>
> I used nls( ) to estimate a and b in this function.
>
> nls(y~ a*x^b,start=list(a=a1,b=b1)
>
> seems the start list I gave was not able to reach convergence and it gave notes: number of iteration s exceeded maximum of 50. Then I put  nls.control(maxiter = 50, tol = 1e-05, minFactor = 1/1024) in nls(.. ), and modified the argument of maxiter = 500. But it worked out as the same way and noted : number of iteration s exceeded maximum of 50. I have totally no idea how to set this parameter MAXITER.
>
> Thanks for any information!

I think you are assuming that values passed to nls.control are
persistent and will apply to further calls to nls.  They don't.  If
you want to increase the maximum number of iterations you do it as

nls(y ~ a*x^b, start = list(a = a1, b = b1), control = list(maxiter = 500))

but I would suggest that you also use trace = TRUE in the call to nls
so you can see where the iterations are going.  Merely increasing the
number of iterations for an optimization that has gone into
never-never land isn't going to help it converge.

Two other things to consider: this is a partially linear model in the
the parameter `a' appears linearly in the model expression.  You may
be able to stabilize the iterations using

 nls(y ~ x^b, start = list(b = b1), control = list(maxiter = 500),
trace = TRUE, alg = 'plinear')

Finally, and most important, please plot the data before trying to fit
a nonlinear model to it so you can see if it has the characteristics
that you would expect from data generate by such a model.  As Brian
Joiner said, "Regression without plots is truly a regression".
>
> Leaf
>
>
> >  Hi  all,
> >
> >  I  found  r-site-research  not  work  for  me  these  days.
> >
> >  When  I  was  doing  nls(  )  ,  there  was  an  error  "number  of  iterations  exceeded  maximum  of  50".  I  set  number  in  nls.control  which  is  supposed  to  control  the  number  of  iterations  but  it  didn't  work  well.  Could  anybody  with  this  experience  tell  me  how  to  fix  it?  Thanks  in  advance!
>
> We  cannot  make  suggestions  unless  you  tell  us  what  you  tried  yourself.
> Id  possible,  please  gib´ve  a  reproducible  examle.
>
> Uwe  Ligges
>
> >  Leaf
> >
> >   [[alternative  HTML  version  deleted]]
> >
> >  ______________________________________________
> >  R-help at 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
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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
>
>



More information about the R-help mailing list