# Re: [R] two term exponential model

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Tue 09 Aug 2005 - 17:42:04 EST

On 09-Aug-05 Prof Brian Ripley wrote:
> On Mon, 8 Aug 2005, Deming Mi wrote:
>

```>> Does anybody know if there is an R function (package) to fit a
>> two-terms exponential model like y = a*exp(bx) + c*exp(dx)
>> where y is dependent variable and x is independent variable.
>> MATLAB has a Curve Fitting Toolbox to implement this fitting,
>> but I don't know if there is an R package for this fitting.
>> Thank you!
```

>
> See ?nls
>

>>From my experience with such models the coefficients are often not
> well-determined and so you need a good starting point.

I concur with this remark. While the determination does depend on the anmount of random error around the curve, the plain fact is that often this error is such that there is little difference in fit between the two-term exponential and a single-term exponential, or between different 2-term models with substantially different exponential terms (and it can get worse with more terms).

I would strongly recommend creating profile-likelihood plots for say (with your parametrisation above) "a" vs "c", "b" vs "d", etc., using the log-likelihood for the MLE as reference, and drawing contours at levels corresponding to P-values (e.g. 75%, 50%, 25%, 10%, 5%) of the chisquare on 2 d.f. for (e.g.) the function of (b,d)

-2*log(L(b,d,ahat(b,d),chat(b,d))) + 2*log(L(aHat,cHat,bHat,dHat))

where ahat(b,d) and chat(b,d) are the MLEs of a and c at fixed b and d, and aHat, cHat, bHat, dHat are the unrestricted MLEs, and similar for (a,c).

Best wishes,
Ted.

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
```Date: 09-Aug-05                                       Time: 08:34:06
------------------------------ XFMail ------------------------------

______________________________________________
```
R-help@stat.math.ethz.ch mailing list