[R] error in nls, step factor reduced below minFactor
Adi Humbert
adrian_humbert at yahoo.com
Mon Feb 16 15:01:15 CET 2004
Hello,
I am trying to estimate 4 parameters of a non-linear
model using nls.
My model function is a Fourier integral and is very
expensive to
calculate. I get the following error:
> theta0 <- c(0.045, 1.02*10^(-4), 0.00169,
5.67*10^(-4))
> res <- nls(log(y) ~ log(model(theta,r,t)),
data=dataModel,
+ start=list(theta=theta0), trace=TRUE,
+ control=nls.control(tol=1e-2))
20.03975 : 0.045000 0.000102 0.001690 0.000567
13.96798 : 0.0080957877 0.0001002399 0.0009541090
0.0005878496
13.57454 : 8.099613e-03 9.852037e-05 9.341490e-04
5.970604e-04
13.26752 : 0.0082989896 0.0000969310 0.0009268296
0.0006044495
13.02448 : 8.654227e-03 9.546088e-05 9.288864e-04
6.103760e-04
12.83024 : 9.135635e-03 9.410033e-05 9.377541e-04
6.151250e-04
12.67412 : 9.720556e-03 9.284061e-05 9.514689e-04
6.189244e-04
12.54838 : 0.0103914582 0.0000916738 0.0009685641
0.0006219567
12.44723 : 1.113468e-02 9.059271e-05 9.879688e-04
6.243689e-04
12.36625 : 1.193956e-02 8.959072e-05 1.008918e-03
6.262796e-04
12.30196 : 0.0127978556 0.0000886618 0.0010308793
0.0006277845
12.25158 : 1.370321e-02 8.780041e-05 1.053488e-03
6.289612e-04
12.21285 : 1.465077e-02 8.700148e-05 1.076503e-03
6.298729e-04
12.18390 : 1.563687e-02 8.626033e-05 1.099771e-03
6.305706e-04
12.16319 : 1.665875e-02 8.557265e-05 1.123197e-03
6.310961e-04
12.14939 : 0.0177143504 0.0000849345 0.0011467278
0.0006314833
12.14139 : 1.880212e-02 8.434221e-05 1.170336e-03
6.317599e-04
12.13825 : 1.992089e-02 8.379241e-05 1.194012e-03
6.319485e-04
12.13761 : 0.0204953365 0.0000835372 0.0012058834
0.0006320080
12.13748 : 2.078483e-02 8.341414e-05 1.211783e-03
6.320311e-04
12.13747 : 0.0209299955 0.0000833537 0.0012147203
0.0006320413
12.13746 : 2.096633e-02 8.333872e-05 1.215453e-03
6.320436e-04
12.13746 : 2.098450e-02 8.333124e-05 1.215819e-03
6.320448e-04
12.13746 : 2.099359e-02 8.332751e-05 1.216002e-03
6.320454e-04
12.13746 : 2.099813e-02 8.332565e-05 1.216093e-03
6.320456e-04
12.13746 : 2.099927e-02 8.332518e-05 1.216116e-03
6.320457e-04
Error in nls(log(y) ~ log(model(theta, r, t)), data =
dataModel, start = list(theta = theta0), :
step factor 0.000488281 reduced below
`minFactor' of 0.000976563
>
The parameters seem to converge well. I don't
understand why the
optimization does not stop. I tried different
nls.controls, to
increase the tol, to reduce the minFactor, but it
makes no difference.
I keep getting the same error. The function "model"
also returns the
gradient calculated numerically. A run like the one
above takes me a
few hours. Can you help? I looked in the archive and
I've seen this
problem popping up, but no clear solution was
presented.
Thank you,
Adrian Dragulescu
More information about the R-help
mailing list