[R] Starting estimates for nls Exponential Fit

dave fournier otter at otter-rsch.com
Thu Dec 3 04:47:47 CET 2009


Figuring out the best parameterization for this kind of model
is a bit tricky until you get the hang of it.
Let the function be

        y_t = y_0 + alpha * E^t

where uppercase Y_t denotes an observed value
and lower case y_t is a predicted value.
Index the times by t_1 .... t_n
WLOG assume that t_1 is the smallest time and t_n is the largest time.

Now we already have a good idea what the predicted values  y_1 and y_n
should be as we have observations for them. We have the two equations

       y_1 = y_0 + alpha * E^t_1

       y_n = y_0 + alpha * E^t_n

we can solve these for alpha in terms of y_1,y_n,and E giving

     alpha = (y_n-y_1)/(E^t_n -E^t_1)       (1)

and solve for y_0  as

         y_0 = y_1 - alpha * E^t_1  using (1) for alpha

Now use the good estimates Y_1 and Y_n  as the starting values
for y_1 and y_n
and try some "reasonable value for E (say 0.1 < E < 100)

Do the minimization in two stages first holding y_1 and y_n fixed and
then estimate y_1,y_n,and E together. This converges in less than a second
using AD Model Builder and the starting values (large value for E.

2018.34 2778.47 exp(10.0)  where I deliberately
used exp(10) as a large initial value for E.
The parameter estimates together with the est std devs
are

  1   y_1     1.9994e+03 3.9177e-01
  2   y_n     2.7881e+03 6.7557e-01
  3   log_E  5.6391e-01 1.2876e-03
  4   alpha      6.0130e-04 1.9398e-05
  5   y_0     1.9906e+03 4.5907e-01
  6   E      1.7575e+00 4.3935e-02

There are problems for E near 1 which need to be dealt with if
you have to go there, but that is just a technicality.

This idea also works well for a logistic say 3 4 or 5 parameter.














-- 
David A. Fournier
P.O. Box 2040,
Sidney, B.C. V8l 3S3
Canada
Phone/FAX 250-655-3364
http://otter-rsch.com




More information about the R-help mailing list