Beruflich Dokumente
Kultur Dokumente
Using Excel
Mike Middleton
DSI 2010 San Diego
Background
The exponential function, Y=c*EXP(b*x), is useful for fitting
some non-linear single-bulge data patterns.
In Excel, you can create an XY (Scatter) chart and add a best-fit
trendline based on the exponential function.
Problem: Regarding the fitted curve for Excels Exponential
Trendline,
(1) the reported value for R Squared is incorrect, and
(2) the fitted values do not minimize Sum of Squared
Deviations.
DSI 2010 San Diego
www.DecisionToolworks.com
www.DecisionToolworks.com
Year
X
1
2
3
4
5
6
7
8
9
10
B
$ Millions
Revenue
Y
$70
$183
$340
$649
$1,243
$1,979
$4,096
$6,440
$8,459
$12,154
Revenue, in Millions
A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$15,000
$10,000
$5,000
$0
10
Year
In Excel 2010, select data A4:B13. Insert XY Scatter chart. Use Chart
Tools Layout to add chart title and axes titles.
Right-click a data point to select the data series, and choose Add
Trendline from the shortcut menu.
DSI 2010 San Diego
www.DecisionToolworks.com
www.DecisionToolworks.com
Year
X
1
2
3
4
5
6
7
8
9
10
B
$ Millions
Revenue
Y
$70
$183
$340
$649
$1,243
$1,979
$4,096
$6,440
$8,459
$12,154
Revenue, in Millions
A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
y = 58.553e0.5694x
R = 0.9828
$15,000
$10,000
$5,000
$0
0
10
Year
Next, compute the fitted values for Y, and use worksheet functions
and formulas to compute the actual value of R Squared
www.DecisionToolworks.com
Year
X
1
2
3
4
5
6
7
8
9
10
B
$ Millions
Revenue
Y
$70
$183
$340
$649
$1,243
$1,979
$4,096
$6,440
$8,459
$12,154
Fitted Y
$103
$183
$323
$571
$1,009
$1,783
$3,151
$5,568
$9,840
$17,389
E
Exponential Trendline
SS Total
SS Regression
SS Residual
156,733,316
125,667,007
31,066,309
R Squared
StDev(Residuals)
0.802
Total SS
Explained SS
Unexplained SS, SSD
Explained SS / Total SS
$1,763
www.DecisionToolworks.com
Year
X
1
2
3
4
5
6
7
8
9
10
B
$ Millions
Revenue
Y
$70
$183
$340
$649
$1,243
$1,979
$4,096
$6,440
$8,459
$12,154
Fitted Y
$103
$183
$323
$571
$1,009
$1,783
$3,151
$5,568
$9,840
$17,389
E
Exponential Trendline
SS Total
SS Regression
SS Residual
=COUNT(B4:B13)*VARP(B4:B13)
=F4-F6
=SUMXMY2(B4:B13,C4:C13)
Total SS
Explained SS
Unexplained SS, SSD
R Squared
=F5/F4
Explained SS / Total SS
StDev(Residuals)
=SQRT(F6/COUNT(B4:B13))
www.DecisionToolworks.com
Year
X
1
2
3
4
5
6
7
8
9
10
B
C
D
E
$ Millions
Coeff c
Revenue
58.55266
Y c*EXP(b*X)
$70
$103
SS Total
$183
$183
SS Regression
$340
$323
SS Residual
$649
$571
$1,243
$1,009
R Squared
$1,979
$1,783
$4,096
$3,151
StDev(Residuals)
$6,440
$5,568
$8,459
$9,840
$12,154
$17,389
F
G
Coeff b
0.569367
156,733,316
125,666,623
31,066,693
0.802
Total SS
Explained SS
Unexplained SS, SSD
Explained SS / Total SS
$1,763
www.DecisionToolworks.com
Year
X
1
2
3
4
5
6
7
8
9
10
B
$ Millions
Revenue
Y
$70
$183
$340
$649
$1,243
$1,979
$4,096
$6,440
$8,459
$12,154
Coeff c
58.55266
c*EXP(b*X)
=$E$2*EXP($F$2*A4)
=$E$2*EXP($F$2*A5)
=$E$2*EXP($F$2*A6)
=$E$2*EXP($F$2*A7)
=$E$2*EXP($F$2*A8)
=$E$2*EXP($F$2*A9)
=$E$2*EXP($F$2*A10)
=$E$2*EXP($F$2*A11)
=$E$2*EXP($F$2*A12)
=$E$2*EXP($F$2*A13)
Coeff b
0.569367
SS Total
SS Regression
SS Residual
=COUNT(B4:B13)*VARP(B4:B13)
=F4-F6
=SUMXMY2(B4:B13,C4:C13)
Total SS
Explained SS
Unexplained SS, SSD
R Squared
=F5/F4
Explained SS / Total SS
StDev(Residuals)
=SQRT(F6/COUNT(B4:B13))
www.DecisionToolworks.com
10
www.DecisionToolworks.com
11
www.DecisionToolworks.com
12
Year
X
1
2
3
4
5
6
7
8
9
10
B
C
$ Millions
Revenue
Y c*EXP(b*X)
$70
$325
$183
$488
$340
$732
$649
$1,098
$1,243
$1,648
$1,979
$2,471
$4,096
$3,707
$6,440
$5,560
$8,459
$8,339
$12,154
$12,509
F
Coeff c
Coeff b
217.0084285 0.40542436
SS Total
SS Regression
SS Residual
156,733,316
154,746,736
1,986,580
R Squared
0.987
StDev(Residuals)
$446
Total SS
Explained SS
Unexplained SS, SSD
Explained SS / Total SS
www.DecisionToolworks.com
13
Trendline
$16,000
$14,000
Revenue, in Millions
$12,000
$10,000
Solver
$8,000
$6,000
$4,000
$2,000
$0
0
10
Year
www.DecisionToolworks.com
14
$ Millions
Revenue
Actual
Y Current/Previous
$70
$183
2.614
$340
1.858
$649
1.909
$1,243
1.915
$1,979
1.592
$4,096
2.070
$6,440
1.572
$8,459
1.314
$12,154
1.437
Average Ratio, 2 to 10
1.809
Average Ratio, 3 to 10
1.708
Average Ratio, 8 to 10
1.441
R^2=0.802, SD(Resid)=$1763
Trendline Exponential
Fitted Y Current/Previous
$103
$183
1.767
$323
1.767
$571
1.767
$1,009
1.767
$1,783
1.767
$3,151
1.767
$5,568
1.767
$9,840
1.767
$17,389
1.767
www.DecisionToolworks.com
R^2=0.987, SD(Resid)=$446
Solver Fit Exponential
Fitted Y Current/Previous
$325
$488
1.500
$732
1.500
$1,098
1.500
$1,648
1.500
$2,471
1.500
$3,707
1.500
$5,560
1.500
$8,339
1.500
$12,509
1.500
15
The exponential trendline feature does not find values of b and c that minimize the
sum of squared deviations between actual y and predicted y (= c * ebx). Instead,
Excel's method takes the logarithm of both sides of the exponential formula, which
then can be written as
Ln(y) = Ln(c) + b * x
and uses standard linear regression with Ln(y) as the dependent variable and x as
the explanatory variable. That is, Excel finds the intercept and slope that minimize
the sum of squared deviations between actual Ln(y) and predicted Ln(y), using the
formula
Ln(y) = Intercept + Slope * x.
Therefore, the Intercept value corresponds to Ln(c), and c in the exponential
formula is equal to Exp(Intercept). The Slope value corresponds to b in the
exponential formula. - Middleton (1995)
DSI 2010 San Diego
www.DecisionToolworks.com
16
Ln(Y)
4.248495
5.209486
5.828946
6.475433
7.125283
7.590347
8.317766
8.770284
9.042986
9.405414
Plot of Ln(Y) vs X
Ln(Y), Ln(Revenue)
X
1
2
3
4
5
6
7
8
9
10
12
10
8
6
4
2
0
0
10
X, Year
Ln(Y), Ln(Revenue)
Y = c*EXP(b*X)
10
X, Year
www.DecisionToolworks.com
c = EXP(LN(c))
c = EXP(4.0699)
c = 58.55
17
www.DecisionToolworks.com
18
www.DecisionToolworks.com
19
The power trendline feature does not find values of b and c that minimize the sum
of squared deviations between actual y and predicted y (= c * xb). Instead, Excel's
method takes the logarithm of both sides of the power formula, which then can be
written as
Ln(y) = Ln(c) + b * Ln(x),
and uses standard linear regression with Ln(y) as the dependent variable and Ln(x)
as the explanatory variable. That is, Excel finds the intercept and slope that
minimize the sum of squared deviations between actual Ln(y) and predicted Ln(y),
using the formula
Ln(y) = Intercept + Slope * Ln(x).
Therefore, the Intercept value corresponds to Ln(c), and c in the power formula is
equal to Exp(Intercept). The Slope value corresponds to b in the power formula.
DSI 2010 San Diego
www.DecisionToolworks.com
20
References
Middleton, M.R. 1995. Data Analysis Using Microsoft Excel 5.0. Duxbury
Press, Belmont, CA.
Winston, W.L. 2004. Microsoft Excel Data Analysis and Business Modeling.
Microsoft Press, Redmond, WA.
www.DecisionToolworks.com
21
http://www.DecisionToolworks.com/ExpCurveFit2010.pptx
http://www.DecisionToolworks.com/ExpCurveFit2010.pdf
http://www.DecisionToolworks.com/ExpCurveFit2010.xlsx