2

This question is less about programming than it is about mathematics, but I would like some opinions.

I'm trying to model the exponential decay behavior of this curve but as you can see there is a certain level of fluctuations/noise at the lower values. How could I eliminate/damp this noise so that my fit isn't as dependent on it?

I work with the log of this curve so I use linear regressions to do the fit. I've used the least squares method, but the slope of the straight line varies significantly (by about 20%) depending on the time interval I choose.

I've heard about 2 other methods that could help:

  • Weighted least squares method, but I don't know how I would go about weighing my points.
  • Least absolute deviations, apparently small values tend to be less relevant using this method.

I would like to avoid the trial and error phase. Do you have any ideas?

Edit: The code is done using python

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Ricardo Fumachi
  • 79
  • 1
  • 11
  • Please add the data and the code you use and maybe also add the `python` tag. – Cleb May 18 '17 at 20:36
  • Fitting exponential decay using linear methods on log-compressed data is incorrect. Try search the net for "kinetic modelling". Many packages exists for solving this kind of problems. An example is kinfit an `R` package. – Jens Munk May 18 '17 at 21:31
  • Could you expand on why is it incorrect to fit it using a linear model? I've obtained correct results so far, It simplifies the equation and the parameters in play are more intuitive. – Ricardo Fumachi May 18 '17 at 21:42
  • I believe you attempted a log transformation or linearization technique. I'm not sure why this wouldn't work. I would need to test the actual data. However, this is a non-linear curve, so non-linear fitting would be a better approach. Applying an exponential model as mentioned with scipy.optimize.curve_fit() should give parameters that fit this data. Do you have the data? I would like to try myself. – pylang May 18 '17 at 22:35
  • 4
    I'm voting to close this question as off-topic because this is a math/statistics question not programming. – Dan Is Fiddling By Firelight Jul 28 '19 at 16:11

1 Answers1

2

If in log-space the decaying part of the data does not look linear, then it is not a simple decay. Actually the data looks more like a sum of an exponential decay and a constant background. So try a model like a*exp(-b*x)+c. The curve in the picture is the right hand side of a gaussian peak (the tails fall more or less exponentially) with constant offset. The fit (green line) is a function as given above.

fit of simulated data

Christian K.
  • 2,785
  • 18
  • 40
  • Yes that's what it is, adding the `c` parameter does help keeping the fit in check. Thank you. Did you use any specific fitting function? – Ricardo Fumachi May 18 '17 at 21:42
  • Just plain least squares, via `scipy.odr`. The image is a screenshot of a peak-o-mat session (http://lorentz.sf.net). – Christian K. May 19 '17 at 12:53