How to do an exponential fit for this data?

Whenever I try to use FindFit or NonlinearModelFit for the data (shown below), I keep getting the following error thrown at me:

RecursionLimit::reclim: Recursion depth of 1024 exceeded.


I am using an exponential model to try and fit it.

data = {0.19676778483499557, 0.20885602228466532, 0.22210833221738427,
0.23668665287868895, 0.252783561788831, 0.2706298263857738,
0.2905043053747535, 0.3127471056565888, 0.3377773233068993,
0.3661173611964135, 0.39842687921844677, 0.43555118981628316,
0.4785919073537348, 0.5290129571413393, 0.5888048389535786,
0.6607490640587161};


The particular model that I'm using is FindFit[data, Exp[a*x] + b, {a, b}, x]

How can I stop getting this error thrown at me/get the model I'm trying to use to work?

• Can you give the exact command you used to fit please? Otherwise it's difficult to tell what's going on. But as a first guess I'd suggest you try again with a fresh kernel. May 17 '19 at 12:51
• @Roman Updated the question. May 17 '19 at 12:55
• Runs fine on my computer. Please try your own code with a fresh kernel. Check ?a and ?b to see if there are any lingering definitions. May 17 '19 at 13:01
• @Roman I took your advice and used a new kernel. Worked just fine. Would you happen to know why using a new kernel worked? May 17 '19 at 13:21
• Lingering definitions of a and b. Check them with ?a and ?b. May 17 '19 at 13:30

Try

fit = FindFit[data, a + b Exp[c x], {a, b, c}, x]
Show[{ListPlot[data],Plot[a + b Exp[c x] /. fit, {x, 1, Length[data]}]}]


• Thank you. That worked beautifully! May 17 '19 at 13:01
• You're welcome. May 17 '19 at 13:02
• Or, equivalently, use Exp[a*x + c] + b for the model. May 17 '19 at 13:20

This is just an extended comment. While the fit might "look" good, an examination of the residuals vs the fit shows that there is still a lot more structure that maybe needs explaining:

ListPlot[Transpose[{fit["PredictedResponse"], fit["FitResiduals"]}],
Frame -> True, FrameLabel -> {"Predicted response", "Fit residual"}]


Three (of many) possibilities: (1) underlying curve is more complicated than first thought and (2) the measurement system has a floating bias, (3) the observations are correlated across the predictor variable (maybe that's "time"?).

The point is that to make inferences from regressions certain assumptions need to hold at least approximately. Such residual plots are just one kind of check on those assumptions to see if there are any gross deviations from those assumptions. A residual plot should be mandatory.