Skip to content

nls - convergence problem

3 messages · peter.schlattmann@t-online.de, Douglas Bates, Spencer Graves

#
Dear list,

I do have a problem with nls. I use the following data:
time  conc dose
   0.50  5.40    1
   0.75 11.10    1
   1.00  8.40    1
   1.25 13.80    1
   1.50 15.50    1
   1.75 18.00    1
   2.00 17.00    1
   2.50 13.90    1
   3.00 11.20    1
  3.50  9.90    1
  4.00  4.70    1
  5.00  5.00    1
  6.00  1.90    1
  7.00  1.90    1
  9.00  1.10    1
12.00  0.95    1
14.00  0.46    1
24.00    NA    1
30.00    NA    1
36.00    NA    1

I use the self-starting function SSfol:

nls(conc~SSfol(dose,time,lKe,lKa,lCl),data=test,trace=T,control=nls.control(maxiter=13,tol=0.001,minFactor=1.E-500),na.action=na.omit)

This gives the following output:

99.15824 :  -1.2061792  0.1296157 -4.3020997 
86.07567 :  -0.7053265 -0.3873204 -4.1278009 
85.19743 :  -0.5548499 -0.5333776 -4.1173627 
85.19246 :  -0.5466376 -0.5415731 -4.1173247 
85.1922 :  -0.5444637 -0.5437461 -4.1173223 
85.1922 :  -0.5442240 -0.5439857 -4.1173223 
85.1922 :  -0.5441337 -0.5440760 -4.1173223 
85.1922 :  -0.5441104 -0.5440993 -4.1173223 
85.1922 :  -0.5440984 -0.5441113 -4.1173223 
85.1922 :  -0.5441089 -0.5441008 -4.1173223 
85.1922 :  -0.5441006 -0.5441091 -4.1173223 
85.1922 :  -0.5441051 -0.5441046 -4.1173223 
85.1922 :  -0.5441051 -0.5441046 -4.1173223 
85.1922 :  -0.5441051 -0.5441046 -4.1173223 

Error in nls(conc ~ SSfol(dose, time, lKe, lKa, lCl), data = test, trace
= T,  : 
        number of iterations exceeded maximum of 13

I do not understand this error message for two reasons:

1. Apparently the algorithm has converged, at the end of the output the
change of parameter estimates seems to be less than 0.001


2. If the maximum number of iterations is reached I would expect a
warning in the case that the algortihm did not converge. However, here
the algorithm apparently has converged. Thus I do not understand what
happened.

What can I do to deal with this problem?

Any help is appreciated!

Many thanks
peter
1 day later
#
peter.schlattmann at t-online.de wrote:
But it hasn't converged.  The nls function uses a relative offset 
convergence criterion that is not being satisfied here.  By setting the 
minimum step factor to a very small number you are more small steps than 
you would otherwise but you are not converging.  It appears that the 
parameter estimates are not defined for this model/data set combination.
#
Hi, Doug: 

      How would you diagnose something like this?  For example, might 
the following (from ?nlsModel) help: 

     DNase1 <- DNase[ DNase$Run == 1, ]
     mod <-
      nlsModel(density ~ SSlogis( log(conc), Asym, xmid, scal ),
               DNase1, start=list( Asym = 3, xmid = 0, scal = 1 ))
     mod$Rmat()        # R matrix from the QR decomposition of the gradient

      Wouldn't the first zero or nearly diagonal element of Rmat 
identify a variable to which the model was insensitive and could 
therefore be fixed or removed from the model? 
      Thanks,
      Spencer Graves
Douglas Bates wrote: