Full_Name: Jerome Asselin
Version: 1.6.1
OS: linux redhat 7.2
Submission from: (NULL) (142.103.173.179)
I am using the nlme package version 3.1-33.
I tried an example from the file "library/nlme/scripts/ch08.R" that comes
with the nlme package but I did not obtain convergence. I assume that
this example worked at some point in the past, but I cannot determine
why it is not working anymore. So I am unable to determine whether this
is a numerical bug or a documentation bug (in the file "ch08.R").
More specifically, I tried the example below (in which I added the
option msVerbose=T.)
library(nlme)
data(Quinidine)
control <- nlmeControl(msVerbose = T)
fm1Quin.nlme <-
nlme(conc ~ quinModel(Subject, time, conc, dose, interval,
lV, lKa, lCl),
data = Quinidine, fixed = lV + lKa + lCl ~ 1,
random = pdDiag(lV + lCl ~ 1), groups = ~ Subject,
start = list(fixed = c(5, -0.3, 2)),
na.action = NULL, naPattern = ~ !is.na(conc), control = control)
#Error in nlme.formula(conc ~ quinModel(Subject, time, conc, dose, interval, :
# Maximum number of iterations reached without convergence
Below is the trace of the calculations by nlme().
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.9645714 1.2393630
Function Value
[1] 1053.026
Gradient:
[1] -5.1732725 -0.3194242
iteration = 10
Parameter:
[1] 5.492493 1.275746
Function Value
[1] 1050.678
Gradient:
[1] -0.0004125939 0.0012034419
Iteration limit exceeded. Algorithm failed.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 5.492303 0.860876
Function Value
[1] 1047.32
Gradient:
[1] 8.080429e-04 -8.308982e-06
iteration = 6
Parameter:
[1] -1772.4732661 0.3624312
Function Value
[1] 815.6329
Gradient:
[1] 9.726484e-25 -2.590048e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.7142093 0.8328863
Function Value
[1] 1045.966
Gradient:
[1] -2.701254 1.837528
iteration = 6
Parameter:
[1] 1.1387817 0.8237138
Function Value
[1] 1045.492
Gradient:
[1] -3.297258e-08 4.558449e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2190786 0.8233033
Function Value
[1] 1044.609
Gradient:
[1] 2.589381 -2.443006
iteration = 7
Parameter:
[1] 0.6880674 0.8342263
Function Value
[1] 1043.658
Gradient:
[1] -5.457107e-08 -1.710382e-06
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6867763 0.8348800
Function Value
[1] 1045.262
Gradient:
[1] -3.318076 2.320207
iteration = 7
Parameter:
[1] 1.2547275 0.8239144
Function Value
[1] 1044.541
Gradient:
[1] 1.496284e-08 -6.761539e-21
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2661227 0.8244986
Function Value
[1] 1044.441
Gradient:
[1] 2.642391 -2.502298
iteration = 1
Parameter:
[1] -1509.6490716 0.8231054
Function Value
[1] 826.5788
Gradient:
[1] 5.044484e-19 3.488575e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851074 0.8350764
Function Value
[1] 1045.189
Gradient:
[1] -3.359032 2.357977
iteration = 7
Parameter:
[1] 1.2648770 0.8239819
Function Value
[1] 1044.448
Gradient:
[1] -1.484278e-08 -4.556966e-08
Last global step failed to locate a point lower than x.
Either x is an approximate local minimum of the function,
the function is too non-linear for this algorithm,
or steptol is too large.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2679928 0.8245302
Function Value
[1] 1044.427
Gradient:
[1] 2.646834 -2.508039
iteration = 1
Parameter:
[1] -1511.23183 0.82312
Function Value
[1] 826.1627
Gradient:
[1] 1.373859e-18 3.405617e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849866 0.8350863
Function Value
[1] 1045.184
Gradient:
[1] -3.361700 2.360219
iteration = 7
Parameter:
[1] 1.2654792 0.8239847
Function Value
[1] 1044.442
Gradient:
[1] -1.483571e-08 -2.278475e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.268088 0.824533
Function Value
[1] 1044.426
Gradient:
[1] 2.647101 -2.508261
iteration = 1
Parameter:
[1] -1511.3133956 0.8231232
Function Value
[1] 827.7616
Gradient:
[1] 1.046018e-18 3.410108e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6850998 0.8350804
Function Value
[1] 1045.188
Gradient:
[1] -3.359382 2.358456
iteration = 7
Parameter:
[1] 1.2650078 0.8239839
Function Value
[1] 1044.447
Gradient:
[1] -1.484124e-08 2.278477e-08
Last global step failed to locate a point lower than x.
Either x is an approximate local minimum of the function,
the function is too non-linear for this algorithm,
or steptol is too large.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680136 0.8245307
Function Value
[1] 1044.426
Gradient:
[1] 2.646877 -2.508084
iteration = 1
Parameter:
[1] -1511.2495885 0.8231376
Function Value
[1] 827.6179
Gradient:
[1] 1.473509e-19 3.477226e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851144 0.8350799
Function Value
[1] 1045.188
Gradient:
[1] -3.359088 2.358286
iteration = 6
Parameter:
[1] 1.2649473 0.8239835
Function Value
[1] 1044.448
Gradient:
[1] 2.968390e-08 -6.835435e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.267994 0.824532
Function Value
[1] 1044.427
Gradient:
[1] 2.646853 -2.507863
iteration = 1
Parameter:
[1] -1511.2336349 0.8231352
Function Value
[1] 828.0258
Gradient:
[1] -6.701743e-20 3.365341e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851079 0.8350803
Function Value
[1] 1045.188
Gradient:
[1] -3.359215 2.358392
iteration = 7
Parameter:
[1] 1.2649721 0.8239836
Function Value
[1] 1044.447
Gradient:
[1] 1.484166e-08 4.556957e-08
Last global step failed to locate a point lower than x.
Either x is an approximate local minimum of the function,
the function is too non-linear for this algorithm,
or steptol is too large.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.268001 0.824530
Function Value
[1] 1044.427
Gradient:
[1] 2.646867 -2.508106
iteration = 1
Parameter:
[1] -1511.2385145 0.8231441
Function Value
[1] 825.0983
Gradient:
[1] -9.146131e-19 3.823514e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849865 0.8350865
Function Value
[1] 1045.184
Gradient:
[1] -3.361722 2.360234
iteration = 6
Parameter:
[1] 1.265490 0.823985
Function Value
[1] 1044.442
Gradient:
[1] -1.254955e-20 -6.835423e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2681041 0.8245325
Function Value
[1] 1044.426
Gradient:
[1] 2.647101 -2.508336
iteration = 1
Parameter:
[1] -1511.3262872 0.8231335
Function Value
[1] 828.0964
Gradient:
[1] 2.680533e-19 3.401084e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6850990 0.8350805
Function Value
[1] 1045.188
Gradient:
[1] -3.359395 2.358484
iteration = 7
Parameter:
[1] 1.2650090 0.8239838
Function Value
[1] 1044.447
Gradient:
[1] -4.452368e-08 -2.278478e-08
Last global step failed to locate a point lower than x.
Either x is an approximate local minimum of the function,
the function is too non-linear for this algorithm,
or steptol is too large.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680059 0.8245313
Function Value
[1] 1044.426
Gradient:
[1] 2.646886 -2.508011
iteration = 1
Parameter:
[1] -1511.24342 0.82312
Function Value
[1] 827.5457
Gradient:
[1] -1.234659e-18 3.430500e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851253 0.8350791
Function Value
[1] 1045.189
Gradient:
[1] -3.358850 2.358082
iteration = 7
Parameter:
[1] 1.2648953 0.8239834
Function Value
[1] 1044.448
Gradient:
[1] -1.800871e-20 -4.556957e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2679782 0.8245315
Function Value
[1] 1044.427
Gradient:
[1] 2.646833 -2.507868
iteration = 1
Parameter:
[1] -1511.2203466 0.8231246
Function Value
[1] 827.655
Gradient:
[1] -6.572921e-20 3.458212e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851108 0.8350802
Function Value
[1] 1045.188
Gradient:
[1] -3.359155 2.358352
iteration = 6
Parameter:
[1] 1.2649595 0.8239835
Function Value
[1] 1044.448
Gradient:
[1] 3.562034e-07 3.850629e-06
Last global step failed to locate a point lower than x.
Either x is an approximate local minimum of the function,
the function is too non-linear for this algorithm,
or steptol is too large.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2679959 0.8245315
Function Value
[1] 1044.427
Gradient:
[1] 2.646857 -2.507940
iteration = 1
Parameter:
[1] -1511.2351449 0.8231327
Function Value
[1] 826.1662
Gradient:
[1] -1.488559e-18 3.469375e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849859 0.8350863
Function Value
[1] 1045.184
Gradient:
[1] -3.361721 2.360224
iteration = 7
Parameter:
[1] 1.2654851 0.8239848
Function Value
[1] 1044.442
Gradient:
[1] 1.483564e-08 2.278475e-08
Last global step failed to locate a point lower than x.
Either x is an approximate local minimum of the function,
the function is too non-linear for this algorithm,
or steptol is too large.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680893 0.8245333
Function Value
[1] 1044.426
Gradient:
[1] 2.647108 -2.508211
iteration = 1
Parameter:
[1] -1511.3143179 0.8231573
Function Value
[1] 826.9291
Gradient:
[1] 2.104922e-20 3.529035e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849815 0.8350874
Function Value
[1] 1045.184
Gradient:
[1] -3.361846 2.360388
iteration = 6
Parameter:
[1] 1.265520 0.823985
Function Value
[1] 1044.442
Gradient:
[1] -2.967047e-08 -2.278474e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.268114 0.824533
Function Value
[1] 1044.426
Gradient:
[1] 2.647111 -2.508323
iteration = 1
Parameter:
[1] -1511.3346598 0.8231364
Function Value
[1] 827.9441
Gradient:
[1] 5.172025e-19 3.451115e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851007 0.8350806
Function Value
[1] 1045.188
Gradient:
[1] -3.359375 2.358493
iteration = 7
Parameter:
[1] 1.2650083 0.8239838
Function Value
[1] 1044.447
Gradient:
[1] -1.484124e-08 -2.278478e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680159 0.8245307
Function Value
[1] 1044.426
Gradient:
[1] 2.646879 -2.508084
iteration = 1
Parameter:
[1] -1511.2514358 0.8231329
Function Value
[1] 827.6347
Gradient:
[1] 1.392743e-18 3.408522e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851072 0.8350800
Function Value
[1] 1045.188
Gradient:
[1] -3.359213 2.358363
iteration = 6
Parameter:
[1] 1.2649669 0.8239834
Function Value
[1] 1044.447
Gradient:
[1] -1.484172e-08 -6.835436e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2679877 0.8245304
Function Value
[1] 1044.427
Gradient:
[1] 2.646868 -2.508028
iteration = 1
Parameter:
[1] -1511.2276862 0.8231314
Function Value
[1] 827.9284
Gradient:
[1] -8.458835e-19 3.418282e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851074 0.8350800
Function Value
[1] 1045.188
Gradient:
[1] -3.359220 2.358355
iteration = 7
Parameter:
[1] 1.2649721 0.8239837
Function Value
[1] 1044.447
Gradient:
[1] 2.968332e-08 -2.162905e-20
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680039 0.8245315
Function Value
[1] 1044.427
Gradient:
[1] 2.646863 -2.507970
iteration = 1
Parameter:
[1] -1511.2418099 0.8231307
Function Value
[1] 821.013
Gradient:
[1] -1.151748e-18 3.745284e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849946 0.8350861
Function Value
[1] 1045.184
Gradient:
[1] -3.361550 2.360118
iteration = 7
Parameter:
[1] 1.2654518 0.8239848
Function Value
[1] 1044.443
Gradient:
[1] -1.483603e-08 2.278475e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680745 0.8245337
Function Value
[1] 1044.426
Gradient:
[1] 2.647091 -2.508132
iteration = 1
Parameter:
[1] -1511.3021850 0.8231395
Function Value
[1] 826.9798
Gradient:
[1] -6.873270e-21 3.541503e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849805 0.8350871
Function Value
[1] 1045.184
Gradient:
[1] -3.361853 2.360357
iteration = 6
Parameter:
[1] 1.265518 0.823985
Function Value
[1] 1044.442
Gradient:
[1] -6.414965e-21 -2.748390e-21
Relative gradient close to zero.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680999 0.8245325
Function Value
[1] 1044.426
Gradient:
[1] 2.647123 -2.508339
iteration = 1
Parameter:
[1] -1511.3228120 0.8231412
Function Value
[1] 827.4251
Gradient:
[1] 2.387140e-18 3.362223e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6850398 0.8350784
Function Value
[1] 1045.187
Gradient:
[1] -3.360343 2.358820
iteration = 6
Parameter:
[1] 1.2651213 0.8239824
Function Value
[1] 1044.446
Gradient:
[1] -1.094700e-20 4.556963e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680295 0.8245309
Function Value
[1] 1044.426
Gradient:
[1] 2.646955 -2.508173
iteration = 1
Parameter:
[1] -1511.262920 0.823141
Function Value
[1] 825.304
Gradient:
[1] 1.503567e-20 3.453135e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849834 0.8350867
Function Value
[1] 1045.184
Gradient:
[1] -3.361774 2.360293
iteration = 6
Parameter:
[1] 1.2654961 0.8239848
Function Value
[1] 1044.442
Gradient:
[1] 1.483552e-08 -2.278475e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680917 0.8245322
Function Value
[1] 1044.426
Gradient:
[1] 2.647117 -2.508340
iteration = 1
Parameter:
[1] -1511.3158054 0.8231388
Function Value
[1] 824.6348
Gradient:
[1] 5.051808e-19 3.498065e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849795 0.8350869
Function Value
[1] 1045.184
Gradient:
[1] -3.361863 2.360350
iteration = 6
Parameter:
[1] 1.265517 0.823985
Function Value
[1] 1044.442
Gradient:
[1] 1.483527e-08 -2.819618e-20
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680970 0.8245325
Function Value
[1] 1044.426
Gradient:
[1] 2.647123 -2.508321
iteration = 1
Parameter:
[1] -1511.3203920 0.8231351
Function Value
[1] 827.997
Gradient:
[1] 2.985541e-19 3.389715e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6850997 0.8350809
Function Value
[1] 1045.188
Gradient:
[1] -3.359386 2.358541
iteration = 7
Parameter:
[1] 1.2650077 0.8239836
Function Value
[1] 1044.447
Gradient:
[1] -1.724167e-20 -4.556957e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2679931 0.8245322
Function Value
[1] 1044.426
Gradient:
[1] 2.646886 -2.507881
iteration = 1
Parameter:
[1] -1511.2332090 0.8231399
Function Value
[1] 827.8576
Gradient:
[1] -4.046823e-19 3.374292e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6851068 0.8350803
Function Value
[1] 1045.188
Gradient:
[1] -3.359240 2.358399
iteration = 7
Parameter:
[1] 1.2649779 0.8239836
Function Value
[1] 1044.447
Gradient:
[1] 1.484159e-08 -2.278478e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2680074 0.8245313
Function Value
[1] 1044.427
Gradient:
[1] 2.646866 -2.507996
iteration = 1
Parameter:
[1] -1511.2447019 0.8231283
Function Value
[1] 828.111
Gradient:
[1] 1.838670e-19 3.383300e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 0.6849700 0.8350883
Function Value
[1] 1045.183
Gradient:
[1] -3.362103 2.360611
iteration = 6
Parameter:
[1] 1.2655782 0.8239852
Function Value
[1] 1044.441
Gradient:
[1] 2.966911e-08 -4.556948e-08
Successive iterates within tolerance.
Current iterate is probably solution.
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 1.2681166 0.8245338
Function Value
[1] 1044.426
Gradient:
[1] 2.647143 -2.508281
iteration = 1
Parameter:
[1] -1511.3374568 0.8231297
Function Value
[1] 827.5546
Gradient:
[1] -1.121176e-18 3.487243e+01
Maximum step size exceeded 5 consecutive times.
Either the function is unbounded below,
becomes asymptotic to a finite value
from above in some direction,
or stepmx is too small.
Error in nlme.formula(conc ~ quinModel(Subject, time, conc, dose, interval, :
Maximum number of iterations reached without convergence
Execution halted
convergence problem with nlme() (PR#2369)
2 messages · Jerome Asselin, Douglas Bates
It turns out that you learn more if you set verbose = TRUE in the call to nlme rather than setting control = nlmeControl(msVerbose = TRUE). The verbose = TRUE option shows you that the parameter values are bouncing back and forth between two regions of the parameter space, neither of which are close to the optimum. It happens that nlm will occasionally take very large steps at the beginning of the optimization resulting in unusual parameter values. This example is a difficult optimization problem. It may be possible to stabilize it somewhat by replacing the internal calls to nlm by calls to optim but that brings its own set of difficulties.