TOPICS
Search

Least Squares Fitting--Exponential


LeastSquaresExp

Exponential least squares fitting with a positive amplitude A uses the model

 y=Ae^(Bx).
(1)

For data with y_i>0 and x_i not all identical, taking the logarithm of both sides gives

 lny=lnA+Bx.
(2)

Minimizing the sum of squared residuals in the logarithms gives

a=(sum_(i=1)^(n)lny_isum_(i=1)^(n)x_i^2-sum_(i=1)^(n)x_isum_(i=1)^(n)x_ilny_i)/(nsum_(i=1)^(n)x_i^2-(sum_(i=1)^(n)x_i)^2)
(3)
b=(nsum_(i=1)^(n)x_ilny_i-sum_(i=1)^(n)x_isum_(i=1)^(n)lny_i)/(nsum_(i=1)^(n)x_i^2-(sum_(i=1)^(n)x_i)^2),
(4)

where B=b and A=exp(a).

In general, this does not minimize the sum of squared errors in y. An alternative is to minimize the weighted sum

 sum_(i=1)^ny_i(lny_i-a-bx_i)^2.
(5)

Applying least squares fitting gives

 asum_(i=1)^ny_i+bsum_(i=1)^nx_iy_i=sum_(i=1)^ny_ilny_i
(6)
 asum_(i=1)^nx_iy_i+bsum_(i=1)^nx_i^2y_i=sum_(i=1)^nx_iy_ilny_i
(7)
 [sum_(i=1)^(n)y_i sum_(i=1)^(n)x_iy_i; sum_(i=1)^(n)x_iy_i sum_(i=1)^(n)x_i^2y_i][a; b]=[sum_(i=1)^(n)y_ilny_i; sum_(i=1)^(n)x_iy_ilny_i].
(8)

Solving for a and b,

a=(sum_(i=1)^n(x_i^2y_i)sum_(i=1)^n(y_ilny_i)-sum_(i=1)^n(x_iy_i)sum_(i=1)^n(x_iy_ilny_i))/(sum_(i=1)^ny_isum_(i=1)^n(x_i^2y_i)-(sum_(i=1)^nx_iy_i)^2)
(9)
b=(sum_(i=1)^ny_isum_(i=1)^n(x_iy_ilny_i)-sum_(i=1)^n(x_iy_i)sum_(i=1)^n(y_ilny_i))/(sum_(i=1)^ny_isum_(i=1)^n(x_i^2y_i)-(sum_(i=1)^nx_iy_i)^2),
(10)

where again A=exp(a) and B=b. In particular, a=lnA is the logarithm of the exponential amplitude.

For small relative residuals, lny_i-a-bx_i approximates (y_i-Ae^(Bx_i))/y_i. Thus the weights y_i approximately weight the squared residuals in y by 1/y_i. Using weights y_i^2 instead approximates equal weighting of the squared residuals in y.

In the plot above, the short-dashed curve is the fit computed from (3) and (4) and the long-dashed curve is the fit computed from (9) and (10).


See also

Least Squares Fitting, Least Squares Fitting--Logarithmic, Least Squares Fitting--Power Law

Explore with Wolfram|Alpha

Cite this as:

Weisstein, Eric W. "Least Squares Fitting--Exponential." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/LeastSquaresFittingExponential.html

Subject classifications