Error in nls: step factor 4.65661e-10 reduced below 'minFactor' of 9.31323e-10

Asked

Viewed 68 times

4

I’m trying to run an analysis "nls", but the following error appears:

"step factor 4.65661e-10 reduced below 'minFactor' of 9.31323e-10"

I am using the following data sets and formula:

n.kill<-c(79,4,86,9,10,49,45,260,10,8,182,16,824,2,11,112)
body<-c(160,1.5,23,40,4.5,4.5,0.8,3,1.2,60,70,0.5,35,30.5,4,47)
df<-data.frame(n.kill, body)
ca=max(df$n.kill)

fun=nls(n.kill~a*(1-exp(-b*body))^c, data=df, start=list(a=ca, b=0.05, c=1), 
  algorithm='plinear', control=nls.control(maxiter = 10000, minFactor = (1/2)^30))

1 answer

2


With the problem data, the following modifications

  • Reduce maxiter to 100;
  • include tol = eps, with eps = .Machine$double.eps^0.5;
  • Use the algorithm 'port' instead of 'plinear'.

achieved convergence in 11 iterations.

eps <- .Machine$double.eps^0.5
fit <- nls(n.kill ~ a*(1 - exp(-b*body))^c, data = df, 
           start = list(a = ca, b = 0.05, c = 1), 
           #trace = TRUE,
           algorithm = 'port', 
           control = nls.control(maxiter = 100, tol = eps))

summary(fit)
#
#Formula: n.kill ~ a * (1 - exp(-b * body))^c
#
#Parameters:
#  Estimate Std. Error t value Pr(>|t|)  
#a 162.8666    87.9631   1.852   0.0869 .
#b   0.1173     0.7910   0.148   0.8844  
#c   0.7839     3.4292   0.229   0.8227  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#Residual standard error: 210.8 on 13 degrees of freedom
#
#Algorithm "port", convergence message: relative convergence (4)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.