I'm trying to extract 4 parameters by fitting one set of data with an ODE via NonlinearModelFit. I originally thought the process should be straightforward, but later on I found I was totally wrong.

The data shown below has a sigmoidal curve:


The model with 4 target parameters (n, m, Ea, LogZ) is below:

model65[n_?NumberQ,m_?NumberQ,Ea_?NumberQ,LogZ_?NumberQ]:=Module[{α,t},First[α /.NDSolve[{α'[t] == ((10^LogZ)/60) Exp[-Ea/(8.314 (65 + 273.15))] α[t]^m (1 - α[t])^n, α[0] == 0}, α, {t, 0, 2400}]]]

Using NonLinearModelFit to extract n, m ,Ea, LogZ (with initial guesses):

fit = NonlinearModelFit[data,model[n, m, Ea, LogZ][t], {{n, 1.5}, {m, 0.5},{Ea, 85000}, {LogZ, 10}}, t];

Below is the error message I'm having:

NonlinearModelFit::fmgz: Encountered a gradient that is effectively zero. The result returned may not be a minimum; it may be a maximum or a saddle point. >>

Can anyone please help me with this problem? Thank you in advance for the great help!


1 Answer 1


I think the system can be simplified. There is no t dependence in ((10^LogZ)/60) Exp[-Ea/(8.314 (65 + 273.15))]). Time can also be rescaled. Jittering initial condition "just off" zero.

After this,

s = y /. ParametricNDSolve[{y'[t] == a y[t]^b (1 - y[t])^c, 
     y[0] == 0.001}, y, {t, 0, 1}, {a, b, c}];
datar = Transpose[{Rescale[#1], #2} & @@ Transpose[data]];

Now fit model (rescaled and simplifying a=1):

nlm = NonlinearModelFit[datar,s[a, b, c][t], {{a, 6}, {b, 0.21}, {c, 1.1}}, t];
Show[ListPlot[datar, PlotMarkers -> {Automatic, 8}],Plot[nlm[t], {t, 0, 1}, PlotStyle -> Red]]

where b and c are exponents and a is constant. enter image description here

I hope this is helpful. Note: I used Manipulate to help with starting values. I have left the full aim to OP or others.

  • $\begingroup$ Thank you so much @ubpdqn !! Just wondering why the time has to be scaled to make the NonlinearModelFit works? Will these fitted parameters be applicable to the real time scale? I really appreciate your great help! $\endgroup$
    – DavidC
    Commented Mar 28, 2016 at 20:56
  • $\begingroup$ @DavidC apologies for delay (time zones). I do not think it needed rescaling but it just made it easier for me. Just look at what rescale does and you will be able to work it out.:) $\endgroup$
    – ubpdqn
    Commented Mar 28, 2016 at 22:14
  • $\begingroup$ @ubpdqnThank you! I really appreciate your great help :) $\endgroup$
    – DavidC
    Commented Mar 29, 2016 at 15:05

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.