Tag Archives: Error in nls

The solution of “error in NLS loop more than 50” in R language

When using multiple nonlinear regression (NLS function) in R language, we often encounter the problem that “the number of error in NLS cycles exceeds the maximum of 50”.

The main reason is that the default maximum number of iterations in NLS is 50. At this time, you only need to use NLS. Control to modify the maximum number of iterations
for example, change the maximum number of iterations to 1000:

nlc <- nls.control(maxiter = 1000)
m1 <- nls(y ~ a * x1 ^ b * x2 ^ c, 
          control = nlc, 
          start = list(a = 1, b = 1, c = 1),
          trace = T)