Regression of Exponential Ramp

82 Views Asked by At

Given a set of measured data ( temperature ), I need to estimate parameters of the exponential function which I suppose be the best fit:

$y=A+C(1-e^{-t/\tau}$)

From an operative point of view, given the samples $(t_i,y_i)$, I need to make a script which output the estimate of $\tau$ or nothing if the estimation error is to high.

The errors on $y_i$ are supposed to be gaussian-distributed, and, for now, $t_i$ are supposed to be error-free.

Moreover, $A$ and $C$ can be supposed to be supposed to be known? $y(\infty)=A+C$ and $y(0)=A$.

4

There are 4 best solutions below

2
On

To fix the "frame" you need first to establish some important assumptions:

1) are the $t_i$ supposed to error-free ? and the "error" (random fluctuation) be only on the $y_i$ ? (which is the "standard" perspective)

2) is the error on the $y_i$ supposed to be gaussian (or else: uniform,..), in absolute or relative terms ?

Only after establishing the above you can , "..reliably", proceed with the appropriate statistics for parameters estimation / rejection.

addendum

So, with the clarifications added to your post, we have $$ y = A + C\left( {1 - e^{\, - t/\tau } } \right) = A + C - C\,e^{\, - t/\tau } $$ onto which we can perform the regression by the Least Squares method.

The problem is that the exponential, specially with a constant additional term, is not "nicely" manageable within the LS scheme.

If $Y_0=A$ is known from physical considerations, and possibly also $Y_{\infty}=A+C$ then the difficulty is quite reduced. But the problem of the exponential remain: the derivative of the square error involves a sum of powers of the variable.

To my experience, the best approach hinges on expressing the exponential through a truncated Taylor series, possibly not over the 2nd degree and in case made piecewise, by appropriately partitioning the time range.

That much depend on the expected range for $t_{min}/\tau, \; t_{max}/\tau$, which determine the truncation error. This shall be negligible wrt the expected $\sigma$ for $y$.

If that is possible, then you can proceed with a linear / quadratic regression, in case over a splitted time-range.

1
On

Admitting that $A$ and $C$ are known, you can estimate $\tau$ rewriting $$\frac{(A+C)-y}C=e^{-\frac t \tau}\implies \log\left(\frac{(A+C)-y}C \right)=-\frac t \tau=a t$$ So, for each data point, define $$z_i=\log\left(\frac{(A+C)-y_i}C \right)$$ and you will get $$a=\frac{\sum_{i=1}^n t_i z_i}{\sum_{i=1}^n t_i^2}\implies \tau=-\frac{\sum_{i=1}^n t_i^2}{\sum_{i=1}^n t_i z_i}$$

This is an estimate since what is measured is $y$ and not any of its possible transforms. Now, you need aa nonlinear regression to fine tune the $ \tau$ parameter.

Since you have now a good estimate of the parameter, continue with $a=-\frac 1 \tau$ and consider that you need to minimize $$SSQ=\sum_{i=1}^n \left(A+C-C e^{a t_i}-y_i\right)^2$$ Compute the derivative with respect to $a$ and set it equal to $0$. You end with the equation $$\sum_{i=1}^n t_i\, e^{at_i}\left(A+C-C e^{a t_i}-y_i\right)=0 \tag 1$$ which cane be solved using graphics or with any numerical method (Newton would be the simplest - even use numerical derivatives).

All the work can be easily done with Excel.

Edit

Let us try an example with the following data set $$\left( \begin{array}{cc} t & y \\ 1 & 260 \\ 2 & 350 \\ 3 & 420 \\ 4 & 460 \\ 5 & 500 \\ 6 & 520 \end{array} \right)$$ where $A=123$ and $C=456$.

The first step leads to $a=-0.344$. Now, using Newton method for solving $(1)$ (with forward differences $\Delta a=\frac a{1000}$ for the computation of the derivatives), we get the following iterates. $$\left( \begin{array}{cc} n & a_n \\ 0 & -0.344000 \\ 1 & -0.345982 \\ 2 & -0.346003 \end{array} \right)$$ I can now confess that the data were generated using $$y=10\, \text{Round}\left[\frac{1}{10} \left(123+456 \left(1-e^{-0.345 t}\right)\right)\right]$$

0
On

For convenience, consider the reduced variable

$$z:=1-\frac{y-A}{C}$$ which also has Gaussian errors, and the model simplifies to

$$z=e^{-t/\tau}=e^{-\sigma t}.$$

Now by least-squares,

$$\frac12\dfrac{\partial}{\partial\sigma}\sum_{k=1}^n\left(z_k-e^{-\sigma t_k}\right)^2=\sum_{k=1}^n t_ke^{-\sigma t_k}\left(z_k-e^{-\sigma t_k}\right)=0$$

or

$$\sum_{k=1}^n t_kz_ke^{-\sigma t_k}=\sum_{k=1}^n t_ke^{-2\sigma t_k}.$$

This is a nasty nonlinear equation, which might have several solutions. Direct minimization of the LS residue might be a better option.

1
On

In addition to the judicious answer from Claude Leibovici, I would like to show another method which doesn't require iterative calculus nor initial guess :

enter image description here

The principle comes from https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales (pages 16-17)

The application to the Leibovici's data is straightforward :

enter image description here

Result below :

enter image description here