View
235
Download
1
Tags:
Embed Size (px)
Citation preview
Finance 30210: Managerial Economics
Demand Forecasting
Suppose that you work for a local power company. You have been asked to forecast energy demand for the upcoming year. You have data over the previous 4 years:
Time Period Quantity (millions of kilowatt hours)
2003:1 11
2003:2 15
2003:3 12
2003:4 14
2004:1 12
2004:2 17
2004:3 13
2004:4 16
2005:1 14
2005:2 18
2005:3 15
2005:4 17
2006:1 15
2006:2 20
2006:3 16
2006:4 19
0
5
10
15
20
25
2003-1 2004-1 2005-1 2006-1
First, let’s plot the data…what do you see?
This data seems to have a linear trend
A linear trend takes the following form:
btxxt 0
Forecasted value at time t (note: time periods are quarters and time zero is 2003:1)
Time period: t = 0 is 2003:1 and periods are quarters
Estimated value for time zero
Estimated quarterly growth (in kilowatt hours)
Regression Results
Variable Coefficient Standard Error t Stat
Intercept 11.9 .953 12.5
Time Trend .394 .099 4.00
Regression Statistics
R Squared .53
Standard Error 1.82
Observations 16txt 394.9.11
Lets forecast electricity usage at the mean time period (t = 8)
50.3ˆ
05.158394.9.11ˆ
t
t
xVar
x
0
5
10
15
20
25
2003-1 2004-1 2005-1 2006-1
Here’s a plot of our regression line with our error bands…again, note that the forecast error will be lowest at the mean time period
T = 8
0
10
20
30
40
50
60
70
Sample
We can use this linear trend model to predict as far out as we want, but note that the error involved gets worse!
7.47ˆ
85.4176394.9.11ˆ
t
t
xVar
x
Time Period Actual Predicted Error
2003:1 11 12.29 -1.29
2003:2 15 12.68 2.31
2003:3 12 13.08 -1.08
2003:4 14 13.47 .52
2004:1 12 13.87 -1.87
2004:2 17 14.26 2.73
2004:3 13 14.66 -1.65
2004:4 16 15.05 .94
2005:1 14 15.44 -1.44
2005:2 18 15.84 2.15
2005:3 15 16.23 -1.23
2005:4 17 16.63 .37
2006:1 15 17.02 -2.02
2006:2 20 17.41 2.58
2006:3 16 17.81 -1.81
2006:4 19 18.20 .79
One method of evaluating a forecast is to calculate the root mean squared error
n
FARMSE tt
2
Number of Observations
Sum of squared forecast errors
70.1RMSE
0
5
10
15
20
25
2003-1 2004-1 2005-1 2006-1
Lets take another look at the data…it seems that there is a regular pattern…
Q2
Q2Q2
Q2
We are systematically under predicting usage in the second quarter
Time Period Actual Predicted Ratio Adjusted
2003:1 11 12.29 .89 12.29(.87)=10.90
2003:2 15 12.68 1.18 12.68(1.16) = 14.77
2003:3 12 13.08 .91 13.08(.91) = 11.86
2003:4 14 13.47 1.03 13.47(1.04) = 14.04
2004:1 12 13.87 .87 13.87(.87) = 12.30
2004:2 17 14.26 1.19 14.26(1.16) = 16.61
2004:3 13 14.66 .88 14.66(.91) = 13.29
2004:4 16 15.05 1.06 15.05(1.04) = 15.68
2005:1 14 15.44 .91 15.44(.87) = 13.70
2005:2 18 15.84 1.14 15.84(1.16) = 18.45
2005:3 15 16.23 .92 16.23(.91) = 14.72
2005:4 17 16.63 1.02 16.63(1.04) = 17.33
2006:1 15 17.02 .88 17.02(.87) = 15.10
2006:2 20 17.41 1.14 17.41(1.16) = 20.28
2006:3 16 17.81 .89 17.81(.91) = 16.15
2006:4 19 18.20 1.04 18.20(1.04) = 18.96
Average Ratios
•Q1 = .87
•Q2 = 1.16
•Q3 = .91
•Q4 = 1.04
We can adjust for this seasonal component…
10
11
12
13
14
15
16
17
18
19
20
2003-1 2004-1 2005-1 2006-1
Now, we have a pretty good fit!!
26.RMSE
0
10
20
30
40
50
60
70
52.4304.185.4176394.9.11ˆ tx
Recall our prediction for period 76 ( Year 2022 Q4)
btxxt 0
Recall, our trend line took the form…
This parameter is measuring quarterly change in electricity demand in millions of kilowatt hours.
Often times, its more realistic to assume that demand grows by a constant percentage rather that a constant quantity. For example, if we knew that electricity demand grew by g% per quarter, then our forecasting equation would take the form
t
t
gxx
100
%10
tt gxx 10
If we wish to estimate this equation, we have a little work to do…
Note: this growth rate is in decimal form
gtxxt 1lnlnln 0
If we convert our data to natural logs, we get the following linear relationship that can be estimated
Regression Results
Variable Coefficient Standard Error t Stat
Intercept 2.49 .063 39.6
Time Trend .026 .006 4.06
Regression Statistics
R Squared .54
Standard Error .1197
Observations 16
txt 026.49.2ln
Lets forecast electricity usage at the mean time period (t = 8)
0152.ˆ
698.28026.49.2ˆln
t
t
xVar
xBE CAREFUL….THESE NUMBERS ARE LOGS !!!
0152.ˆ
698.28026.49.2ˆln
t
t
xVar
x
The natural log of forecasted demand is 2.698. Therefore, to get the actual demand forecast, use the exponential function
85.14698.2 e
Likewise, with the error bands…a 95% confidence interval is +/- 2 SD
945.2,451.20152.2/698.2
00.19,60.11, 945.2451.2 ee
0
5
10
15
20
25
30
2003-1 2004-1 2005-1 2006-1
Again, here is a plot of our forecasts with the error bands
T = 8 70.1RMSE
0
1
2
3
4
5
6
7
1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97
When plotted in logs, our period 76 ( year 2022 Q4) looks similar to the linear trend
207.ˆln
49.476026.49.2ˆln
t
t
xVar
x
0
100
200
300
400
500
600
1 13 25 37 49 61 73 85 97
Again, we need to convert back to levels for the forecast to be relevant!!
8.221,8.352/
22.8949.4
SD
eErrors is growth rates compound quickly!!
Quarter Market Share
1 20
2 22
3 23
4 24
5 18
6 23
7 19
8 17
9 22
10 23
11 18
12 23
Consider a new forecasting problem. You are asked to forecast a company’s market share for the 13th quarter.
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10 11 12
There doesn’t seem to be any discernable trend here…
Smoothing techniques are often used when data exhibits no trend or seasonal/cyclical component. They are used to filter out short term noise in the data.
Quarter Market Share
MA(3) MA(5)
1 20
2 22
3 23
4 24 21.67
5 18 23
6 23 21.67 21.4
7 19 21.67 22
8 17 20 21.4
9 22 19.67 20.2
10 23 19.33 19.8
11 18 20.67 20.8
12 23 21 19.8
A moving average of length N is equal to the average value over the previous N periods
N
ANMA
t
Ntt
1
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10 11 12
Actual
MA(3)
MA(5)
The longer the moving average, the smoother the forecasts are…
Quarter Market Share
MA(3) MA(5)
1 20
2 22
3 23
4 24 21.67
5 18 23
6 23 21.67 21.4
7 19 21.67 22
8 17 20 21.4
9 22 19.67 20.2
10 23 19.33 19.8
11 18 20.67 20.8
12 23 21 19.8
Calculating forecasts is straightforward…
MA(3)
33.213
231823
MA(5)
6.205
1722231823
So, how do we choose N??
Quarter Market Share
MA(3) Squared Error
MA(5) Squared Error
1 20
2 22
3 23
4 24 21.67 5.4289
5 18 23 25
6 23 21.67 1.7689 21.4 2.56
7 19 21.67 7.1289 22 9
8 17 20 9 21.4 19.36
9 22 19.67 5.4289 20.2 3.24
10 23 19.33 13.4689 19.8 10.24
11 18 20.67 7.1289 20.8 7.84
12 23 21 4 19.8 10.24
Total = 78.3534 Total = 62.48
95.29
3534.78RMSE 99.2
7
48.62RMSE
Exponential smoothing involves a forecast equation that takes the following form
ttt FwwAF 11
Forecast for time t+1 Actual value at
time t
Forecast for time t
Smoothing parameter
Note: when w = 1, your forecast is equal to the previous value. When w = 0, your forecast is a constant.
1,0w
Quarter Market Share
W=.3 W=.5
1 20 21.0 21.0
2 22 20.7 20.5
3 23 21.1 21.3
4 24 21.7 22.2
5 18 22.4 23.1
6 23 21.1 20.6
7 19 21.7 21.8
8 17 20.9 20.4
9 22 19.7 18.7
10 23 20.4 20.4
11 18 21.2 21.7
12 23 20.2 19.9
For exponential smoothing, we need to choose a value for the weighting formula as well as an initial forecast
Usually, the initial forecast is chosen to equal the sample average
8.216.205.235.
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10 11 12
Actual w=.3 w=.5
As was mentioned earlier, the smaller w will produce a smoother forecast
Calculating forecasts is straightforward…
W=3
04.212.207.233.
W=5
45.219.195.235.
So, how do we choose W??
Quarter Market Share
W=.3 W=.5
1 20 21.0 21.0
2 22 20.7 20.5
3 23 21.1 21.3
4 24 21.7 22.2
5 18 22.4 23.1
6 23 21.1 20.6
7 19 21.7 21.8
8 17 20.9 20.4
9 22 19.7 18.7
10 23 20.4 20.4
11 18 21.2 21.7
12 23 20.2 19.9
Quarter Market Share
W = .3 Squared Error
W=.5 Squared Error
1 20 21.0 1 21.0 1
2 22 20.7 1.69 20.5 2.25
3 23 21.1 3.61 21.3 2.89
4 24 21.7 5.29 22.2 3.24
5 18 22.4 19.36 23.1 26.01
6 23 21.1 3.61 20.6 5.76
7 19 21.7 7.29 21.8 7.84
8 17 20.9 15.21 20.4 11.56
9 22 19.7 5.29 18.7 10.89
10 23 20.4 6.76 20.4 6.76
11 18 21.2 10.24 21.7 13.69
12 23 20.2 7.84 19.9 9.61
Total = 87.19 Total = 101.5
70.212
19.87RMSE 91.2
12
5.101RMSE