1
$\begingroup$

I am attempting to fit some data that seems to follow an equation that is the sum of two exponentials. When fitting with a single exponential the residual histogram is not normally distributed. The sum of two single exponentials with a weighting term fits the data well, however the parameters are very susceptible to initial guesses. I am fitting this equation to 60 different data sets to determine the parameters, so I am trying to find a general method to determine the parameters. A weighted least squared minimization is what I am currently doing, but depending on initial guesses and bounds it is likely to not give a good fit (based on distribution of residuals). So are there other techniques for fitting the data?

Equation I am using (with roughly 16000 points of $t, F(t)$ and determined variance at each time point): $$F(t) = F_0+(F_{eq}-F_0)A*e^{-k_1*t}+(F_{eq}-F_0)(1-A)*e^{-k_2*t}$$ Where $F_0$ and $F_{eq}$ are bounded in fitting and have initial estimates directly based on data (initial and endpoints). $1≥A≥0$ and $k_{1,2}≥0$

To be more specific I am fitting a kinetic process of binding to a protein. I am fitting this at multiple concentrations and then fitting $k_1$ and $k_2$ (which are actually $k_{obs1}$ and $k_{obs2}$) at multiple concentrations. If I take the values when the residuals aren't normally distributed and plot them, there is not a correlation between concentrations. If I force the values enough to give a normal distribution, then there is a correlation between concentrations (as there should be).

Here's a link to a csv containing a condensed version of one trace (averaged every ten values to ~1500 points). Scipy curve fit works fairly well here and gives me values of $F_0, F_{eq}, A, k_1, k_2 ≈ 0.9977, 0.00074, 0.8166, 0.0715, 0.271$, which gives me a reasonably good fit based on the distribution of residuals. However the provided answer gives me p = -2.0565 and q = -1154 assuming I've properly coded it. https://drive.google.com/file/d/1vLp4hGlXOv8kCXfuD39jIMiEQJQcGC-t/view?usp=sharing

$\endgroup$
2
  • $\begingroup$ Can you joint to your question a representative example of data. Of course not 16000 points but a smaller number of points enough to be able to reproduce the difficulty that you encountered. $\endgroup$
    – JJacquelin
    Sep 17 at 5:29
  • $\begingroup$ I'll edit my post shortly to do that, I'll take every ten points for a representative trace. $\endgroup$
    – cmay
    Sep 20 at 14:48
2
$\begingroup$

Since the OP added an example of data to his question it is now possible to show the calculus using the method proposed in my first answer.

For me, the goal isn't to solve accurately the problem. The goal is to give an example of numerical calculus in full details so that everybody can reproduce it and be able to check each step. To make it easier we will not use the original data of 1500 points but a subset of only 20 points taken among them.

x= 1.0045 1.7445 2.4945 3.2445 3.9945 4.7445 5.4945 6.2445 6.9945 7.7445 8.4945 9.2445 9.9945 17.445 24.945 32.445 39.945 47.445 54.945 62.445

y= 0.89855 0.833921 0.774222 0.719953 0.674778 0.631464 0.592844 0.555447 0.521094 0.49169 0.462038 0.437067 0.412439 0.234885 0.136977 0.081586 0.049508 0.029161 0.017968 0.008837

enter image description here

Once your code is correctly running with this representative example you can use it with the whole data.

If a particular criteria of fitting (LMSE or LMSRE or other) is formally requiered you can use the approximate values of p,q,a,b,c obtained as very good initial values of parameters for a non-linear regression software with the specified criteria of fitting implemented into it. This answers to the question about avoiding "guessed" initial values of the parameters.

$\endgroup$
2
  • $\begingroup$ Thank you! I will likely do the suggestion of taking a subset to dynamically find initial parameters, which should allow a dynamic fitting. I'm not sure why the large set didn't work when I tried it but I will be able to figure it out now. $\endgroup$
    – cmay
    2 days ago
  • $\begingroup$ @cmay. Even with the large set the method works verry well. It isn't a good idea to take a subset. The accuracy of the result is certainely better from the large set. If it doesn't work properly probably there is a bug in the code. May be a trouble in the two numerical integrations (calculus of the $S_k$ and $SS_k$ ? Are the points correcttly ranked ? $\endgroup$
    – JJacquelin
    9 hours ago
0
$\begingroup$

The principle of a method which doesn't need initial guess is explained in this paper : https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales

The example pp.71-73 is not directly applicable in your case. A small adaptation is necessary. See below :

enter image description here

The relationships of symbols are :

$a=F_0$ ; $b=(F_{eq}-F_0)A$ ; $c=(F_{eq}-F_0)(1-A)$ ; $p=-k_1$ ; $q=-k_2$ .

From the values of $a,b,c,p,q$ obtained it is easy to compute $F_0$ , $F_{eq}$ , $A$ , $k_1$ , $k_2$ .

If a representative data had been joint to the question I had checked to say if the method is convenient in your case and eventually I had adapt the method more specifically.

IN ADDITION , after the data was joint to the question :

With the whole data (1499 points) the numerical calculus following the above method leads to :

enter image description here

The points are drawn in red.

The fitted curve is drawn in blue.

$\endgroup$
6
  • $\begingroup$ I'm having trouble believing such simple formulas will generally work, especially because $p=-k_1$ implies $k_1$ is negative, whereas the model in the question requires positivity. $\endgroup$
    – whuber
    Sep 17 at 18:44
  • $\begingroup$ I don't think it: it's a property of the formula you wrote, following from $A\gt 0.$ $\endgroup$
    – whuber
    Sep 17 at 21:04
  • $\begingroup$ I see that you don't want to post a representative example of data. Without it I will not waste time in sterile discussion. Bye-bye. $\endgroup$
    – JJacquelin
    Sep 18 at 6:20
  • $\begingroup$ I found this solution shortly after I posted the question, however on my data it was giving me q ~ -1700 if I remember correctly (definitely was a large negative number, <-1000). Whatever the value was, it gave several terms as 0 in the second matrix, making it impossible to invert. But I'll try it again with a subset of the data and post it in a few hours. $\endgroup$
    – cmay
    Sep 20 at 14:54
  • $\begingroup$ I just checked and it was p, q = -17.7, -11700. Ill update with representative data shortly and recalculate those values on the subset of data $\endgroup$
    – cmay
    Sep 20 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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