6
$\begingroup$

I'm trying to fit an exponential with noise (which in this case is a constant $c$) like this one

$$ y(x) = \alpha e^{- \alpha x} + c \text{ ,}$$

having $(x_i, y_i)$ values (So $\alpha$ and $c$ are unknown and are the ones that I want to determine). Without the noise I would simply linearize the values and then apply the least squares method, but with the noise I have no idea how to do that. Are there any formulas to do it? Thank you.

$\endgroup$
3
  • $\begingroup$ It reads to me like you're fitting an exponential curve to (x,y) data. You should clarify the properties of this noise, since the idea of noise actually being constant is counterintuitive. Can you please provide more details about what you're observing and what this 'noise' is. Without the $c$ term, what's the variation around the mean in the model like? When you take logs, would you see changing spread of the error term with changing $x$? $\endgroup$
    – Glen_b
    Commented May 10, 2015 at 2:56
  • $\begingroup$ It is like a traslated exponential, in which I know only its points and I want to find alpha and C $\endgroup$
    – Domenico
    Commented May 10, 2015 at 2:59
  • $\begingroup$ One important consideration is how you expect the variation about the functional form to come into it. Aksakal's suggestion of nonlinear regression would be especially suitable if the amount of variation about the signal (where 'signal' is made up of both the exponential curve and the translation) were nearly-constant in absolute magnitude across $x$ and zero-mean at each $x$. It's also probably the easiest starting point. [If the variability about the signal tends to change with mean, you may want to consider something else.] ... do you have a small amount of sample data? $\endgroup$
    – Glen_b
    Commented May 10, 2015 at 3:06

2 Answers 2

4
$\begingroup$

In the absence of a response to my questions relating to the variation about the signal, I'll explain a little about nonlinear least squares.

You can fit a model of the following form: $y_i = c + \alpha \exp(-\alpha x_i)+\varepsilon_i$, where $E(\varepsilon_i)=0$.

If the $\varepsilon$ values are independent and of constant variance (or close to it), this should be quite a good approach (and would be my idea of a good starting point). If they're also normal it will also be maximum likelihood, and makes for simpler confidence intervals and tests (should you want those).

There's no closed form formula for the parameter estimates. They must be obtained iteratively, generally by taking a linear approximation at a current estimate to get the next estimate. Software to do this is in most stats packages.

Here's an example.

I made a tiny set of (x,y) data (here printed to 4 significant figures):

     x     y
 1.186 2.695
 2.805 2.677
 3.095 2.657
 1.399 2.661
 2.150 2.713
 7.989 2.547
 1.847 2.673
 3.867 2.588
 7.133 2.580
 6.136 2.581
 1.230 2.711
 7.272 2.581

I fitted your model in R (free statistical software), as follows:

expfnfit = nls( y ~ c+a*exp(-a*x) , start=list(c=2,a=.5))  # fits the model

summary(expfnfit) # shows information about the fit

Formula: y ~ c + a * exp(-a * x)

Parameters:
  Estimate Std. Error t value Pr(>|t|)    
c 2.529316   0.008608 293.848  < 2e-16 ***
a 0.229818   0.027285   8.423 7.48e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.02448 on 10 degrees of freedom

Number of iterations to convergence: 6 
Achieved convergence tolerance: 1.39e-06

enter image description here

$\endgroup$
5
  • $\begingroup$ I think that OP meant to say that $c$ is the noise, i.e. what is usually denoted as $\varepsilon_i$ $\endgroup$
    – Aksakal
    Commented May 10, 2015 at 3:42
  • $\begingroup$ @aksakal Maybe, but I'm pretty sure that's not the case, because it's explicitly described as constant ("which in this case is a constant $c$"); note also it doesn't have an index $i$, yet both $x$ and $y$ do. If it's constant it's not what a statistician would normally call noise -- indeed it seems to be a parameter since the OP explicitly mentions wanting to estimate it. I expect that this noise source simply lifts the background of whatever is being measured, shifting up by (on average) a constant amount. I agree it's not 100% clear, which is why I sought clarification. ... (ctd) $\endgroup$
    – Glen_b
    Commented May 10, 2015 at 6:27
  • $\begingroup$ (ctd)... There's also the fact that the OP said that without it they'd just take logs and use least squares --- but if that's the noise, then without it there's no need for least squares -- just pick any two points and take log(y) and use the two-point form of a straight line. $\endgroup$
    – Glen_b
    Commented May 10, 2015 at 6:31
  • $\begingroup$ @Aksakal Sorry guys, you are right, maybe my question was not so clear. I know that there are languages like mathlab or R that do all the job for me. But I have to implement the code in C language of an agorithm that is able to fit that kind of distribution: a decreasing exponential which is traslated up or down by a constant. So what I want to found is alpha and c, or better I want to find C in order to remove it and then find alpha. I simply want the procedure to do that like in least square where tehre are formulas to find m and q of a linerar model like y=mx+q $\endgroup$
    – Domenico
    Commented May 10, 2015 at 14:47
  • $\begingroup$ I already explained (see paragraph 4 above) that there aren't simple closed form formulas for nonlinear least squares. The algorithms to compute nonlinear least squares are nontrivial. They would take pages of text to explain, since it seems there's quite a bit of stuff you'd need to know first (start here for an idea of the general approach), but no doubt there are already C libraries that do it for you. Edit: ... yep, there's a bunch -- start here $\endgroup$
    – Glen_b
    Commented May 10, 2015 at 23:07
0
$\begingroup$

First of all, are you sure that the noise is additive? For instance, if your noise was multiplicative, then linearization would have worked.

For an additive noise you can't do much. Use nonlinear regression.

$\endgroup$
3
  • $\begingroup$ yes I'm sure it is additive $\endgroup$
    – Domenico
    Commented May 10, 2015 at 2:48
  • $\begingroup$ in this case which are the formula? $\endgroup$
    – Domenico
    Commented May 10, 2015 at 2:51
  • $\begingroup$ There's no formula. You fit the nonlinear function. $\endgroup$
    – Aksakal
    Commented May 10, 2015 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.