I am trying to fit an exponential model of form y = ae^(xb) in R to the data I have ran below, using the nls() function. I have read here and in other places that I need to feed the model reasonable parameters for a and b, but the way about getting those starting parameters seems very variable, and many of the suggested ways were methods that I could not find elaborations on. One suggestion said that you could copy your data into an Excel spreasheet, fit your model on the graph, and adjust the parameters until it appeared to fit the data reasonably well. Well, I went into Google Sheets, I inserted a chart based on the data below, and then selected Customize > Series > Trendline (exponential), and it fed me a formula of 5.51e^0.015x . Are these valid values I could use as my starting parameters? Does Google Sheets produce those effectively, or do I need to do the tinkering method, or try something else? I have read over and over again the importance of choosing proper starting values, so any help on this would be much appreciated. My educational background did not cover non linear models.

x       y
19.005  5.49
18.19   6
19.59   5.885
19.93   8.96
17.615  13.85
18.795  2.72
19.11   8.09
19.885  8.11
15.76   6.66
16.48   6.27
15.805  5.375
15.825  3.06
15.985  7.795
15.755  6.255
15.485  5.925
15.475  9.925
16.45   6.055
16.285  5.24
15.92   11.15
16.775  5.57
16.075  3.275
16.475  5.635
16.825  4.72
16.28   2.035
17.26   6.07
17.245  4.9
17.98   8.06
17.35   6.94
18.22   7.8
16.27   12.2
17.555  7.335
16.98   5.76
17.415  7.51
17.5    6.18
  • $\begingroup$ Is there some reason why you are fitting this model as a nonlinear exponential, instead of fitting a linear model based on the logarithms of both sides: $\log y = \log a + bx$? The latter approach would be particularly appropriate if you thought that errors in $y$ tend to be proportional to the values of $y$ instead of independent of the $y$ values. $\endgroup$
    – EdM
    Sep 19, 2020 at 18:53
  • $\begingroup$ I am not sure. I was told by our research group that this model is traditionally used as the typical one to model the relationship between temperature and soil respiration (my data represents those two features), and thus our first step that they wanted me to do was to check how well this model fits. $\endgroup$
    – Cameron
    Sep 19, 2020 at 21:18

1 Answer 1


Probably the best way to check whether your initial parameter estimates are adequate for a good nonlinear fit is to look at the plot of the fitted function against the data points. The end of my answer here shows what can happen with a poor initial choice. My sense is that such problems are more likely with non-monotonic functions as in that example, so your simple monotonic exponential function (rising or falling depending on the sign of $b$) shouldn't pose much of a problem.

Any reasonable way to get starting estimates should be OK if you then check the results by plotting to let you know to try a different estimates. I'm not sure how Google Sheets deals with an exponential trend line, but it's probably at least good enough for that. I would probably just do a log transform of both sides of your equation to get:

$$\log y = \log a + bx $$

and do a linear regression to solve the whole problem (if errors in $y$ are proportional to its values) or get starting estimates for $a$ and $b$ if you need to do the non-linear fit because of your assumptions about the error terms in your model.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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