# Nonlinear experimental data fit without initial parameters

I am trying to fit correlation data into a non-linear model but it is not working. My data plot looks like this:

The equation I am using for fit is

The Mathematica script i am using looks like:

(*Define the exponential decay model*)
model1[t_, a_, b_, c_, d_, e_, f_, g_, h_, i_, j_] :=
a (1 - b Exp[-t/c]) (1 + d Exp[-t/e]) (1 +
f Exp[-t/g]) (1 + h Exp[-t/i])/((1 + (t/j)) (1 + (0.04 t/j))^0.5)

(*Input data*)

newdata = {{-9.5, 0.987}, {-9.4, 1.141}, {-9.3, 1.139}, {-9.201,
1.097}, {-9.1, 1.12}, {-9.0, 1.088}, {-8.9, 1.101}, {-8.8,
1.123}, {-8.700000000000001, 1.123}, {-8.6, 1.143}, {-8.5,
1.161}, {-8.4, 1.171}, {-8.3, 1.203}, {-8.2, 1.211}, {-8.1,
1.204}, {-8.0, 1.18}, {-7.9, 1.187}, {-7.8, 1.196}, {-7.7,
1.184}, {-7.6000000000000005, 1.193}, {-7.5, 1.188}, {-7.4,
1.188}, {-7.3, 1.192}, {-7.2, 1.195}, {-7.1000000000000005,
1.194}, {-7.0, 1.195}, {-6.9, 1.197}, {-6.8, 1.198}, {-6.7,
1.204}, {-6.6000000000000005, 1.205}, {-6.5, 1.209}, {-6.4,
1.211}, {-6.3, 1.212}, {-6.2, 1.21}, {-6.1000000000000005,
1.212}, {-6.0, 1.21}, {-5.9, 1.21}, {-5.8, 1.209}, {-5.7,
1.208}, {-5.6000000000000005, 1.206}, {-5.5, 1.203}, {-5.4,
1.198}, {-5.3, 1.195}, {-5.2, 1.19}, {-5.1000000000000005,
1.185}, {-5.0, 1.18}, {-4.9, 1.173}, {-4.8, 1.167}, {-4.7,
1.16}, {-4.6000000000000005, 1.153}, {-4.5, 1.146}, {-4.4,
1.14}, {-4.3, 1.135}, {-4.2, 1.13}, {-4.1, 1.125}, {-4.0,
1.12}, {-3.9, 1.114}, {-3.8000000000000003, 1.107}, {-3.7,
1.1}, {-3.6, 1.092}, {-3.5, 1.084}, {-3.4,
1.076}, {-3.3000000000000003, 1.067}, {-3.2, 1.059}, {-3.1,
1.052}, {-3.0, 1.045}, {-2.9, 1.038}, {-2.8000000000000003,
1.033}, {-2.7, 1.028}, {-2.6, 1.024}, {-2.5, 1.021}, {-2.4,
1.018}, {-2.3000000000000003, 1.015}, {-2.2, 1.013}, {-2.1,
1.012}, {-2.0, 1.011}, {-1.9000000000000001, 1.01}, {-1.8,
1.009}, {-1.7, 1.009}, {-1.6, 1.008}, {-1.5,
1.008}, {-1.4000000000000001, 1.008}, {-1.3, 1.007}, {-1.2,
1.007}, {-1.1, 1.007}, {-1.0, 1.007}, {-0.9, 1.007}, {-0.8,
1.007}, {-0.7000000000000001, 1.007}, {-0.6, 1.007}, {-0.5,
1.007}, {-0.4, 1.007}, {-0.3, 1.007}, {-0.2, 1.007}, {-0.1,
1.006}};

(*Extract the x and y data*)

xData = newdata[[All, 1]];
yData = newdata[[All, 2]];

(*Perform curve fitting to find the best-fit values for a,b,and c*)

initialGuess = {1, 1, 1, 1, 1, 1, 1, 1, 1,
1}; (*Initial guess for parameters a,b,and c*)

nlm = NonlinearModelFit[newdata,
model1[t, a, b, c, d, e, f, g, h, i, j], {a, b, c, d, e, f, g, h,
i, j}, t, Method -> "LevenbergMarquardt"];

nlm[t]

But I am not able to fit it. the table format of my raw data is as follows:

      X         Y
______    _____

-9.5    0.987
-9.4    1.141
-9.3    1.139
-9.201    1.097
-9.1     1.12
-9    1.088
-8.9    1.101
-8.8    1.123
-8.7    1.123
-8.6    1.143
-8.5    1.161
-8.4    1.171
-8.3    1.203
-8.2    1.211
-8.1    1.204
-8     1.18
-7.9    1.187
-7.8    1.196
-7.7    1.184
-7.6    1.193
-7.5    1.188
-7.4    1.188
-7.3    1.192
-7.2    1.195
-7.1    1.194
-7    1.195
-6.9    1.197
-6.8    1.198
-6.7    1.204
-6.6    1.205
-6.5    1.209
-6.4    1.211
-6.3    1.212
-6.2     1.21
-6.1    1.212
-6     1.21
-5.9     1.21
-5.8    1.209
-5.7    1.208
-5.6    1.206
-5.5    1.203
-5.4    1.198
-5.3    1.195
-5.2     1.19
-5.1    1.185
-5     1.18
-4.9    1.173
-4.8    1.167
-4.7     1.16
-4.6    1.153
-4.5    1.146
-4.4     1.14
-4.3    1.135
-4.2     1.13
-4.1    1.125
-4     1.12
-3.9    1.114
-3.8    1.107
-3.7      1.1
-3.6    1.092
-3.5    1.084
-3.4    1.076
-3.3    1.067
-3.2    1.059
-3.1    1.052
-3    1.045
-2.9    1.038
-2.8    1.033
-2.7    1.028
-2.6    1.024
-2.5    1.021
-2.4    1.018
-2.3    1.015
-2.2    1.013
-2.1    1.012
-2    1.011
-1.9     1.01
-1.8    1.009
-1.7    1.009
-1.6    1.008
-1.5    1.008
-1.4    1.008
-1.3    1.007
-1.2    1.007
-1.1    1.007
-1    1.007
-0.9    1.007
-0.8    1.007
-0.7    1.007
-0.6    1.007
-0.5    1.007
-0.4    1.007
-0.3    1.007
-0.2    1.007
-0.1    1.006

**What's happening here? How can I accurately fit the data? ** The references for a sample paper where similar data has been curve fitted are :

• Welcome to Mathematica StackExchange! You have to provide better initial values ("guesses") for the parameters. It will help if the values have the correct sign (positive/negative), and are approximately at the correct order of magnitude. Then use NonlinearModelFit[newdata, model1[t, a, b, c, d, e, f, g, h, i, j], {{a, 1}, {b, 1}, {c, 1}, {d, 1}, {e, 1}, {f, 1}, {g, 1}, {h, 1}, {i, 1}, {j, 1}}, t] but replace all 1s with your initial values. Sep 4 at 17:18
• Also, it looks like your model is a function of t, whereas the x-values in your data are Log[t]. Sep 4 at 18:38
• After addressing @MelaGo 's comment, It's also worth asking: are there any constraints on your parameters?
– ydd
Sep 4 at 20:50

The main issue is that you haven't programmed your model correctly. In your theoretical model you have $$|\tau|$$ but in the Mathematica code you don't have the absolute value. Making that change and using Method -> "NMinimize" results in the following:

model1[t_, a_, b_, c_, d_, e_, f_, g_, h_, i_, j_] :=
a (1 - b Exp[-Abs[t]/c]) (1 + d Exp[-Abs[t]/e]) (1 +
f Exp[-Abs[t]/g]) (1 +
h Exp[-Abs[t]/i])/((1 + (Abs[t]/j)) (1 + (0.04 Abs[t]/j))^0.5)

(*Input data*)
newdata = {{-9.5, 0.987}, {-9.4, 1.141}, {-9.3, 1.139}, {-9.201,
1.097}, {-9.1, 1.12}, {-9.0, 1.088}, {-8.9, 1.101}, {-8.8,
1.123}, {-8.700000000000001, 1.123}, {-8.6, 1.143}, {-8.5,
1.161}, {-8.4, 1.171}, {-8.3, 1.203}, {-8.2, 1.211}, {-8.1,
1.204}, {-8.0, 1.18}, {-7.9, 1.187}, {-7.8, 1.196}, {-7.7,
1.184}, {-7.6000000000000005, 1.193}, {-7.5, 1.188}, {-7.4,
1.188}, {-7.3, 1.192}, {-7.2, 1.195}, {-7.1000000000000005,
1.194}, {-7.0, 1.195}, {-6.9, 1.197}, {-6.8, 1.198}, {-6.7,
1.204}, {-6.6000000000000005, 1.205}, {-6.5, 1.209}, {-6.4,
1.211}, {-6.3, 1.212}, {-6.2, 1.21}, {-6.1000000000000005,
1.212}, {-6.0, 1.21}, {-5.9, 1.21}, {-5.8, 1.209}, {-5.7,
1.208}, {-5.6000000000000005, 1.206}, {-5.5, 1.203}, {-5.4,
1.198}, {-5.3, 1.195}, {-5.2, 1.19}, {-5.1000000000000005,
1.185}, {-5.0, 1.18}, {-4.9, 1.173}, {-4.8, 1.167}, {-4.7,
1.16}, {-4.6000000000000005, 1.153}, {-4.5, 1.146}, {-4.4,
1.14}, {-4.3, 1.135}, {-4.2, 1.13}, {-4.1, 1.125}, {-4.0,
1.12}, {-3.9, 1.114}, {-3.8000000000000003, 1.107}, {-3.7,
1.1}, {-3.6, 1.092}, {-3.5, 1.084}, {-3.4,
1.076}, {-3.3000000000000003, 1.067}, {-3.2, 1.059}, {-3.1,
1.052}, {-3.0, 1.045}, {-2.9, 1.038}, {-2.8000000000000003,
1.033}, {-2.7, 1.028}, {-2.6, 1.024}, {-2.5, 1.021}, {-2.4,
1.018}, {-2.3000000000000003, 1.015}, {-2.2, 1.013}, {-2.1,
1.012}, {-2.0, 1.011}, {-1.9000000000000001, 1.01}, {-1.8,
1.009}, {-1.7, 1.009}, {-1.6, 1.008}, {-1.5,
1.008}, {-1.4000000000000001, 1.008}, {-1.3, 1.007}, {-1.2,
1.007}, {-1.1, 1.007}, {-1.0, 1.007}, {-0.9, 1.007}, {-0.8,
1.007}, {-0.7000000000000001, 1.007}, {-0.6, 1.007}, {-0.5,
1.007}, {-0.4, 1.007}, {-0.3, 1.007}, {-0.2, 1.007}, {-0.1,
1.006}};

nlm = NonlinearModelFit[
newdata, {model1[t, a, b, c, d, e, f, g, h, i, j], j > 10}, {a, b,
c, d, e, f, g, h, i, j}, t, Method -> "NMinimize"];

Show[ListPlot[newdata], Plot[nlm[t], {t, Min[newdata[[All,1]]], Max[newdata[[All,1]]]}]]

Either there is something off about the first data point or the model is inadequate. (The error structure certainly doesn't meet the assumptions of constant variance and independent errors.)

Seven of the 10 parameters are not even close to being statistically significant and there are high correlations (close to +1 and -1) among the parameter estimators.

nlm["ParameterTable"]

Round[nlm["CorrelationMatrix"], 10^-3] // MatrixForm

• Actually, maybe @MelaGo 's comment about the log of $t$ being in the data rather than $t$ highlights the most important difference between the theoretical equation and the model definition in model1.
– JimB
Sep 5 at 4:21