Chapter 7

advertisement

1

Chapter 7

My interest is in the future because I am going to spend the rest of my life there.—

Charles F. Kettering

Forecasting

Time-Series Analysis

2

A time series is numerical sequence of values generated over regular time intervals.

The classical time-series model involves four components:

Secular trend ( T t

).

Cyclical movement ( C t

).

Seasonal fluctuation ( S t

).

Irregular variation ( I t

).

The multiplicative model determine the level of the forecast variable Y t

:

Y t

= T t

× C t

× S t

× I t

3

Classical Time-Series Model

Exponential Smoothing

4

Finding the components is difficult.

A direct approach averages past Y t values by exponential smoothing .

The forecast value is computed from

F

t+1

= a

Y t

+ (1

a

)F t

The above involves a single parameter, the smoothing constant

( a ) alpha.

All previous time periods are reflected in the F s, and greater weight is given to the more recent.

5

Forecasts with Single-Parameter

Exponential Smoothing

Single-Parameter Forecasts

The preceding slide shows single-parameter forecasts of Blitz Beer sales. These were generated by computer.

The level for a was .20. A greater a will assign more weight to the present.

Quality of forecasts may be measured. Most common is the mean squared error :

6

(Y t

F t

) 2

MSE = n which averages errors over all forecasts made.

Other measures are the mean absolute deviation

( MAD ) and mean absolute percent error ( MAPE ).

Two-Parameter Exponential

Smoothing

The smoothing constant can be tuned to the past, possibly providing better forecasts.

But single-parameter forecasts may still lead or lag actuals , as seen for Blitz Beer, because the impact of trends is delayed.

Trend T t can be incorporated with a second trend smoothing constant g

(gamma):

T t b t

=

= a

Y g

(T t t

+ (1 – a

)(T

t –1

T

t –1

) + (1 –

+ b

t –1

) g

)b

t –1

7

F

t+1

= T t

+ b t

 That greatly reduces Blitz Beer’s

MSE .

8

Forecasts with Two-Parameters

9

Seasonal Exponential Smoothing with Three Parameters

Many time series have regular seasonal patterns to be incorporated into forecasts.

The three-parameter model incorporates a seasonal smoothing constant b

(beta):

T t

= a(

Y t

/S

t p

) + (1 – a

)(T

t –1

+ b

t –1

) b t

= g

(T t

T

t –1

) + (1 – g

)b

t –1

S t

= b(

Y t

/T t

) + (1 – b

)S

t p

F

t+1

= (T t

+ b t

) S

t p+1

10

Forecasting with

Three Parameters

11

Forecasting with

Three Parameters

The above works for p = 4 quarters or p =

12 months .

The preceding slide needs 6 quarters to generate the first (very bad) forecast.

The process settles quickly, providing good forecasts p periods into the future.

Forecasting Trend Using

Regression

To forecast years in advance, regression analysis provides a trend line .

Ŷ(X) = a + bX

The independent variable X is years beyond the base period, the forecast or dependent variable is Y.

The regression coefficients a (intercept) and b (slope) are found (with the computer) by applying the least squares method .

12

The following applies to toothpaste sales Y .

13

Forecasting Trend Using

Regression

Regression in Causal Models

14

Regression analysis can make forecasts with with a non-time independent variable.

A simple regression employs a straight line.

Ŷ(X) = a + bX

The dependent variable is not time periods, such as:

 store size

 order amount

 weight

For 10 rail shipments, the transportation time Y was forecast for specific distance X .

15

Forecasting Transportation Time from Distance

Multiple Regression in

16

Forecasting

Regression fits data employing a multiple regression equation with several predictors:

Ŷ = a + b

1

X

1

+ b

2

X

2

Floorspace X

1 and advertising expense X

2 make forecasts of hardware outlet sales Y :

Ŷ

=

-

22,979 + 11.42

X

1

+ 23.41

X

2

The above was obtained in a computer run using 10 data points.

Forecast with X

1

=2,500 sq.ft. and X

2

=$750:

Ŷ =

-

22,979+11.42(2,500) + 23.41(750)=$23,129

Forecasting Using Seasonal

Indexes

The classical time-series model provides a rationale for isolating seasonal components:

17

Y t

Moving average

=

T t

× C t

× S t

× I t

T t

× C t

= S t

× I t

The procedure is the ratio-to-movingaverage method :

(1) Compute moving averages from Y s.

(2) Center above.

(3) Express Y s as % of moving average.

(4) Determine medians by season and adjust.

Above (done on computer) leaves only S t

.

18

Excel Forecasting

Templates and Tools

Single-parameter exponential smoothing

Two-parameter exponential smoothing

Three-parameter exponential smoothing

Regression

Classical time series analysis

19

Exponential Smoothing Tool

Single-parameter exponential smoothing is easy with Excel’s ToolPak. Click on Tools on the menu bar, select the Data Analysis option, and then in the Data Analysis dialog box, click on Exponential Smoothing.

Single-Parameter

Exponential Smoothing

(Figure 7-4 )

1. Enter the smoothing constant in D2.

3. If more than

20 periods of data are available, expand columns

B, C, and D to include all the data by inserting rows. Then copy the formula in E26 down to all the cells in the expanded table.

1

2

3

4

5

26

27

28

29

30

31

22

23

24

25

18

19

20

21

11

12

13

14

15

16

17

6

7

8

9

10

A B C D E F

Forecast of Blitz Beer Sales by Single-Parameter Smoothing a

= 0.2

Month

Period Actual Forecast t Sales, Y t

Sales, F t

January 2000

February

March

April

May

June

July

August

September

October

November

December

January 2001 13

February 14

March

April

15

16

May

June

July

August

September

17

18

19

20

21

8

9

6

7

10

11

12

3

4

5

1

2

4,890

4,910

4,970

5,010

5,060

5,100

5,050

5,170

5,180

5,240

5,220

5,280

5,330

5,380

5,440

5,460

5,520

5,490

5,550

5,600

5153.5

5188.8

5227.0

5269.6

5307.7

5350.2

5378.1

5412.5

5450.0

4890.0

4894.0

4909.2

4929.4

4955.5

4984.4

4997.5

5032.0

5061.6

5097.3

5121.8

MSE = 24,254

2. Enter problem information in

B6:D25. Notice

D26 does not have a value because it is to be forecast.

4. Click on Tool,

Data Analysis, and the

Exponential

Smoothing to get the

Exponential

Smoothing dialog box shown next.

20

28

D

=SUMXMY2(D7:D25,E7:E25)/COUNT(E7:E25)

1. In the Input

Range line enter the range of the data. The result shown is

$D$6:$D$25

2. Enter the

Damping factor.

It is 1 a.

3. In the Output

Range enter the location of the results.

Exponential Smoothing Dialog Box

(Figure 7-5)

4. Click the OK button to get the results shown previously in Figure 7-4.

21

1. Enter the smoothing constants in C2 and E2.

Two-Parameter Exponential

Smoothing

(Figure 7-6)

2. Enter problem information in

A6:C25. Notice

C26:E25 do not have values because they correspond to the period for which the forecast is being made.

22

A B

Period t

13

14

15

16

9

10

11

12

7

8

5

6

3

4

1

2

17

18

19

20

21

C

Actual

Sales, Y t

4,890

4,910

4,970

5,010

5,060

5,100

5,050

5,170

5,180

5,240

5,220

5,280

5,330

5,380

5,440

5,460

5,520

5,490

5,550

5,600

D E

Forecast of Blitz Beer Sales by Two-Parameter Smoothing a

= 0.20

g

= 0.30

F

1

2

3

4

5

18

19

20

21

14

15

16

17

10

11

12

13

8

9

6

7

26

27

28

29

30

22

23

24

25

31

32

33

Month

January 2000

February

March

April

May

June

July

August

September

October

November

December

January 2001

February

March

April

May

June

July

August

September

7

8

9

=C6

D

MSE =

=$C$2*C8+(1-$C$2)*(D7+E7)

=$C$2*C9+(1-$C$2)*(D8+E8)

Trend

4,890

4,922

4,958

5,001

5,046

5,076

5,122

5,164

5,210

5,245

5,283

5,324

5,367

5,414

5,457

5,504

5,536

5,571

5,608

1,734.64

=C7-C6

T t

E

Trend

Slope, b

20.0

23.6

27.5

31.9

35.9

34.0

37.6

38.9

41.1

39.3

39.0

39.5

40.5

42.5

42.7

43.9

40.5

38.9

38.3

t

=$E$2*(D8-D7)+(1-$E$2)*E7

=$E$2*(D9-D8)+(1-$E$2)*E8

Forecast

Sales, F

F

=D7+E7

=D8+E8 t

4,910.0

4,945.6

4,985.9

5,032.7

5,082.1

5,109.7

5,159.4

5,202.4

5,251.0

5,284.1

5,322.3

5,363.3

5,407.2

5,456.2

5,499.6

5,547.6

5,576.5

5,610.1

5,646.3

3. If more than

20 periods of data are available, expand columns A, B, and C to include all the data by inserting rows.

Copy the formulas in

D25:E25 down to the next to last row in the expanded table. Finally, copy F26 down to all the rows in the expanded table.

2. To minimize the MSE,

Min is selected in the Equal

To line.

3. The

Changing

Cells line has the location of the two smoothing parameters.

23

Finding the Best Smoothing

Parameters with Solver

(Figure 7-7)

NOTE: Normally all these entries appear in the Solver Parameter dialog box so you only need to click on the Solve button. However, you should always check to make sure the entries are correct for the problem you are solving. 1. The location of the MSE is in the Set Target Cell line.

6. Click the

Solve button to get Figure

7-6, shown previously.

4. In the

Subject to the

Constraints box the two smoothing parameters are restricted to being equal to or less than one.

5. Click the

Options button to verify that nonnegative smoothing parameters are specified.

Normally, all these entries already appear.

You will need to use this dialog box only if you need to add a constraint.

If you need to change a constraint, the

Change

Constraint dialog box functions just like this one.

24

The Add Constraint Dialog Box

(Figure 7-8)

The Add Constraint dialog box is used to specify the constraints on the variable in the

Changing Cells line. Enter a smoothing parameter such as C2 in the Cell Reference line. Select a sign by clicking on the down arrow in the middle, and then enter the right-hand side in the Constraint line (1 here). Click OK when finished.

1. Enter the smoothing constants in C2,

E2, and G2.

2. Enter problem information in

A6:C33.

3. If less or more than 7 years of data are available, shorten or expand columns

A, B, and C to include all the data by deleting or inserting rows. Copy the formulas in

D33:G33 down through the last quarter of the next to last year in the expanded

25 table.

Three-Parameter Exponential

Smoothing

(Figure 7-11)

A B

Seasonal Exponential Smoothing Results for Stationer's Supply a

= 0.4

C D g

= 0.5

E F b

= 0.7

G

1

2

3

4

5

Actual

Quarter t Sales, Y t

Trend

T t

Slope b t

Seasonal Forecast

S t

F t

16

17

30

31

32

33

34

9

10

11

12

13

14

15

6

7

8

39

40

41

42

43

35

36

37

38

44

45

46

47

1994 W 1 90,640

1988 S

1988 S

2 115,540

3 99,190

1988 F 4 128,800

1995 W 5 102,350

1988 S

1988 S

1988 F

6 127,440

7 112,530

8 145,080

1996 W 9 110,490

1988 S 10 143,000

1988 S 11 119,700

1988 F 12 157,760

90,640.00

109,000.00

129,898.00

131,637.20

125,873.45

126,709.16

135,663.60

141,482.77

140,679.34

24,900.00

21,630.00

21,264.00

11,501.60

2,868.93

1,852.32

5,403.38

5,611.27

2,403.92

1.27

0.91

0.99

0.78

139,367.04

144,273.63

545.81

2,726.20

2000 W 25 157,500

1988 S 26 192,240

1988 S 27 168,330

1988 F 28 218,960

2001 W 29

1988

1988

1988

S

S

F

30

31

32

1 1

1 2

1 3

189,364.54

193,811.82

197,257.56

200,406.97

3,818.46

4,132.87

3,789.30

3,469.36

0.83

0.99

0.85

1.09

F G

=$G$ 2*(C 11/ D11)+(1-$ G$2)* F7 =(D1 0+E 10)* F7

=$G$ 2*(C 12/ D12)+(1-$ G$2)* F8 =(D1 1+E 11)* F8

=$G$ 2*(C 13/ D13)+(1-$ G$2)* F9 =(D1 2+E 12)* F9

1.09

0.89

1.05

0.78

1.04

0.87

1.08

11

12

13

7

8

9

10

MSE = 182,250,569

=C 6

D

=$ C$ 2 *C8+(1 -$ C$ 2)*(D 7 +E7 )

=C 7-C 6

E

=$ E$ 2 *(D 8 -D 7 )+(1 -$ E$ 2)*E7

F

=C 7 /D 7

=C 8 /D 8

=$ C$ 2 *C9+(1 -$ C$ 2)*(D 8 +E8 ) =$ E$ 2 *(D 9 -D 8 )+(1 -$ E$ 2)*E8 =C 9 /D 9

=$ C $2 *C 10+(1 -$ C$ 2)*(D 9 +E9 ) = $E$ 2 *(D1 0 -D 9 )+(1 -$ E$ 2)*E9 =C1 0/D 10

D

=$C $2*(C 11 /F 7)+(1 -$C $2)*(D 10+E 10 )

=$C $2*(C 12 /F 8)+(1 -$C $2)*(D 11+E 11 )

=$C $2*(C 13 /F 9)+(1 -$C $2)*(D 12+E 12 )

182,460.91

117,155.57

127,474.78

109,681.80

160,498.09

128,011.99

146,355.98

153,529.94

190,688.25

169,803.61

220,716.23

168,800.51

205,365.30

180,182.79

234,460.18

39

E

= SUM XMY2(C11:C33,G11:G 33)

/COUNT (G11:G 33)

4. Finally, copy the four forecasting formulas in

G34:G37 to the last four rows of the expanded table (the last year).

Make sure that these formulas refer back to last row of data. In this spreadsheet the forecasting formulas in cells G34:G37 refer back to row 33 which contains the data for the fall of

2000, the last period.

Thus, if the four forecasting formulas in the expanded table are in

G44:G47 then they should refer back to row

43, the last row of data.

11

12

13

F G

=$G$ 2*(C1 1/D11) +(1-$G$2 )*F7 = (D10 +E10 )*F7

=$G$ 2*(C1 2/D12) +(1-$G$2 )*F8 = (D11 +E11 )*F8

=$G$ 2*(C1 3/D13) +(1-$G$2 )*F9 = (D12 +E12 )*F9

11

12

13

7

8

9

10

D

= C6

=$C$2*C8+ (1-$C $2)*(D 7+E 7)

=C7-C6

E

=$E$2*(D8-D7) +(1- $E$2 )*E7

F

=C7/D7

=C8/D8

=$C$2*C9+ (1-$C $2)*(D 8+E 8) =$E$2*(D9-D8) +(1- $E$2 )*E8 =C9/D9

=$C$2*C10+ (1-$C $2)*(D 9+E 9) =$E$2*(D10-D9) +(1- $E$2 )*E9 = C10/D10

D

=$C$2*(C 11/F7)+(1-$C$2)*(D10+E10)

=$C$2*(C 12/F8)+(1-$C$2)*(D11+E11)

=$C$2*(C 13/F9)+(1-$C$2)*(D12+E12)

39

E

= SUMXMY2(C11:C33,G 11:G33)

/CO UNT(G 11:G33)

26

Regression

Regression is easy with Excel’s Regression

Tool. Click on Tools on the menu bar, select the Data Analysis option, and then in the Data

Analysis dialog box select Regression. This yields the Regression dialog box shown next.

1. In the Input Y

Range line enter the range of the Y data.

The result shown here is $C$7:$C$16

Regression Dialog Box

(Figure 7-18)

3. Click on the

OK button to get the Regression

Summary

Output shown next.

2. In the Input X

Range line enter the range of the

X data. The result here shown is

$B$7:$B$16

27

Excel’s Regression Tool

(Figure 7-16)

The slope and intercept are read from E15:E16 and yield the regression equation below. The multiple R,

R squared, adjusted R, standard error, and F and t

28

7

8

9

10

11

12

13

14

15

16

1

2

3

4

5

6 statistics are shown also.

A B C D E F

Fitting Trend Line to BriDent Toothpaste Sales Using Regression

Year

Year in

Transformed

Units

X

Unit

Sales

(thousands)

Y

SUMMARY OUTPUT

Regressi on S tat ist ics

Multiple R 0.98

R Square

Adjusted R Square

Standard Er ror

Observat ions

0.96

0.96

0.90

10

1992

1993

1994

1995

1996

1997

1998

1999

2000

2001

2

3

0

1

4

5

8

9

6

7

72.9

74.4

75.9

77.9

78.6

79.1

81.7

84.4

Y

85.9

84.8

ANO VA

Regr ession

Resi dual

Tot al

I nter cept

X

72 ..

96

 df

1

8

9

1 .

47 X

SS

177.47

6.46

183.92

M S F

177.47

219.86

0.81

C oeff icients St andard Er ror t Stat

72.96

0.53

138.17

1.47

0.10

14.83

G

S ignificance F

0.00

29

Multiple Regression

(Figure 7-21)

26

27

28

29

30

31

32

20

21

22

23

24

25

33

34

35

16

17

18

19

12

13

14

15

7

8

9

10

11

36

1

2

3

4

5

6

A

Store

8

9

6

7

10

1

4

5

2

3

ANOVA

Regression

Residual

Total

Intercept

X

1

X

2

B C D E

Multiple Regression for the Deuce Hardware Store

Monthly

Sales

Y

20,100

14,900

16,800

9,100

15,500

26,700

34,600

7,200

21,800

23,400

SUMMARY OUTPUT

Regression Statistics

Multiple R 0.89332611

R Square 0.798031538

Standard Error 4168.371133

Observations 10 df

Floorspace

Monthly

Advertising

(square feet) Expenditure

X

1

X

2

Y

3,050

1,300

1,890

1,750

1,010

2,690

4,210

1,950

2,830

2,030

 -

350

980

830

760

930

770

440

570

310

920

22 , 979

11

F

Excel’s

-47917.10

5.99

2.99

G regression tool can be used to do multiple regression. Just list ALL the X variables when designating the

Input X Range;

C7:D16 in this example.

.

42

SS MS F Significance F

2 480581774.7

240290887.3

13.8294383

0.003702478

7 121627225.3

17375317.9

9 602209000

Coefficients Standard Error

-22979 10546.50

11.42

2.29

23.41

8.64

t Stat

-2.18

4.98

2.71

P-value

0.07

0.00

0.03

X

1

Lower 95% Upper 95%

1959.87

16.84

43.84

23 .

41 X

2

1. Enter problem information in A19:C46.

2. If more than 7 years of data are available, expand columns A, B, and C to include all the data by inserting rows.

Copy the formulas in

D44:F44 down through the first two quarters of the last year of the data in the expanded table. The

Seasonal Indices in column G are the same every year so enter their values in the expanded table (for the rows corresponding to data and also the rows for the year for which forecasts are being calculated).

30

Classical Time Series

Analysis

(Figure 7-22)

1

4

5

2

3

10

11

12

13

8

9

6

7

14

15

16

17

18

1994 W

1988 S

1988 S

1988 F

1995 W

1988 S

1988 S

1988 F

1996 W

1988 F

2000 W

1988 S

1988 S

1988 F

2001 W

1988 S

1988 S

1988 F

46

47

48

49

42

43

44

45

50

51

52

23

24

25

26

27

19

20

21

22

53

54

55

A B C D E F G H

Quarter

CLASSICAL TIME SERIES ANALYSIS

C

PROBLEM: Stationer's Supply

Ratio Index

6

7

8

9

= MEDIAN(F23,F27,F31,F35,F39,F43)

= MEDIAN(F24,F28,F32,F36,F40,F44)

= MEDIAN(F21,F25,F29,F33,F37,F41)

= MEDIAN(F22,F26,F30,F34,F38,F42)

Winter

Spring

Summer

Fall

88.15% 88.18%

105.92% 105.95%

90.43% 90.46%

115.36% 115.40%

8

9

6

7

D

=C6*4/SUM($C$6:$C$9)

=C7*4/SUM($C$6:$C$9)

=C8*4/SUM($C$6:$C$9)

=C9*4/SUM($C$6:$C$9)

19

20

21

H

=C19/G19

=C20/G20

=C21/G21

PROBLEM: Stationer's Supply

PROBLEM DATA

20

21

22

D

=AVERAGE(C19:C22)

E F

=AVERAGE(C20:C23) =AVERAGE(D20:D21) =C21/E21

=AVERAGE(C21:C24) =AVERAGE(D21:D22) =C22/E22

Quarter t

Four-

Quarter Centered Original as a

Moving Moving Percentage of Seasonal Seasonally

Average Average Moving Average Index Adjusted

28

29

30

31

32

24

25

26

27

7

8

5

6

9

3

4

1

2

Actual

Sales, Y t

90,640

115,540

99,190

128,800

102,350

127,440

112,530

145,080

110,490

202,960

157,500

192,240

168,330

218,960

168,488

205,759

178,505

231,317

108,543

111,470 110,006

114,445 112,958

117,780 116,113

121,850 119,815

123,885 122,868

127,775 125,830

129,568 128,671

177,045 175,010

180,258 178,651

184,258 182,258

90.17%

114.03%

88.15%

106.36%

91.59%

115.30%

85.87%

115.97%

88.16%

105.48%

88.18% 102,786.7

105.95% 109,046.3

90.46% 109,646.5

115.40% 111,612.8

88.18% 116,066.0

105.95% 120,277.5

90.46% 124,392.8

115.40% 125,720.3

88.18% 125,296.9

115.40% 175,876.7

88.18% 178,606.7

105.95% 181,435.6

90.46% 186,075.1

115.40% 189,741.7

88.18% 191,066.8

105.95% 194,194.5

90.46% 197,322.3

115.40% 200,450.1

47

48

49

50

C

=H47*G47

=H48*G48

=H49*G49

=H50*G50

47

48

49

50

H

=FORECAST(B47,$H$19:$H$46,$B$19:$B$46)

=FORECAST(B48,$H$19:$H$46,$B$19:$B$46)

=FORECAST(B49,$H$19:$H$46,$B$19:$B$46)

=FORECAST(B50,$H$19:$H$46,$B$19:$B$46)

3. (cont’d)

Copy the formula in H44 down through the end of the data in the expanded table. Make sure that the forecasting formulas in the expanded table (the ones currently in H47:H50) refer back to the last period of data (like the formulas in H47:H50 refer back to

H46).

31

Other Forecasting Templates on the CD-ROM

The three parameter-exponential smoothing and classical time series analysis templates described previously are for quarterly data.

The CD-ROM also contains threeparameter exponential smoothing and classical time series analysis templates for monthly data.

Download