# Using NonlinearModelFit with NIntegration

Before actually elaborate my question, just a little bit of contextualization: i'm trying to reproduce a result published in a paper. The experimental data presented by the paper's author are as follow:

data = {{0.995, 0.142}, {3.003, 0.2}, {5.908, 0.25}, {10.525, 0.36}, {13.617,
0.498}, {24.321, 0.616}, {33.917, 0.599}, {47.843, 0.7}, {64.172,
0.835}, {91.353, 1.102}, {126.745, 1.083}, {174.118,
1.225}, {225.059, 1.133}, {292.998, 1.165}, {369.133,
1.298}, {640.295, 1.365}, {828.169, 1.298}, {1255.39,
1.373}, {1496.61, 1.409}, {1942.79, 1.538}}


To fit this experimental data the authors used the following equation

$$M(t) = M_{eq}+(M_0-M{eq}) \exp(-t/\tau)$$

and considered that the parameter $$\tau$$ is not a single value, but actually logNormally distributed (i.e., f($$\tau$$) = LogNormal).

Then using this two considerations the authors fitted the data and as a 'by-product' estimated the 'shape' of f($$\tau$$) (i.e., the mean value and dispersion, see the inset of the next figure). The result is shown below.

Now my attempting: To reproduce this analysis, my approach was:

Setting $$M_0=0$$, I multiplied the right side of the equation above for a lognormal f($$\tau$$) and tried to numerically integrate the resulting equation, considering as limits of integration 0.01 and 100. In order to try to fit the data with the assumed lognormal f($$\tau$$), I used the NonlinearModelFit function. The code is below:

I used the following code (and setting $$M_0$$=0):

nlm = NonlinearModelFit[data,
NIntegrate[
meq - meq*Exp[-t/\[Tau]]*(1/(Sqrt[2*Pi]*\[Sigma]*\[Tau]))*
Exp[-(((-\[Mu] + Log[\[Tau]])^2)/(2*\[Sigma]^2))], {\[Tau], 0.01,
100}]
, {\[Sigma], \[Mu], meq}, t]


But unfortunately the result is not satisfactory (see below). It's seems that the numerical integration is not computed when used as the expression in NonlinearModelFit.

Does anyone have any suggestions?

Thanks in advance and stay safe!!

• Would you cite the reference? And how is this question different from the one you asked in August of last year: mathematica.stackexchange.com/questions/204200/….
– JimB
May 9, 2020 at 3:03
• Hi, JimB. Both question are essencially the same. The point is that I just can't reproduce this result without the assumption of an integration over f($\tau$) (just as you suggested me in the first question). There is no mention about how did they exactly fitted this data with the equation posted here and also if the f($\tau$) is calculated numerically (as a byproduct of the fitting of exp data) or determined by trial or error. The reference is doi.org/10.1016/j.pepi.2006.05.002. Thanks! May 9, 2020 at 17:47