[Math] Fitting exponential curve to data

regression

If I have a collection of data points that follow an exponential curve relationship, how can I manually construct the equation that defines the best-fit exponential curve for the data?

Best Answer

I assume you are looking for a curve of the form $y=Ae^{kx}$.

For all your data points $(x_i,y_i)$, compute $w_i=\ln(y_i)$.

Find in the usual way constants $a,b$ such that the line $w=a+bx$ is a line of best fit to the data $(x_i,w_i)$.

Then $e^a$ and $b$ are good estimates for $A$ and $k$ respectively.

Added: "Line of best fit" is a huge subject. We describe a basic method, least squares. The idea is to find numbers $a$ and $b$ which minimize $$\sum_{i=1}^n \left(w_i -(a+bx_i)\right)^2.$$ It turns out that the best $b$ and $a$ are given by the following formulas: $$b=\frac{\sum_{i=1}^n x_iw_i -\frac{1}{n}\left(\sum_{i=1}^n x_i\right)\left(\sum_{i=1}^n w_i\right)}{\sum_{i=1}^n x_i^2 -\frac{1}{n}\left(\sum_{i=1}^n x_i\right)^2}$$ and $$a =\frac{1}{n}\sum_{i=1}^n w_i -\frac{1}{n}b\sum_{i=1}^n x_i,$$ where $b$ is given by the previous formula.

I suggest you look for "least squares" elsewwhere for a more detailed discussion.

Related Question