Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Forecasting Session 2.0 2024

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

BY:

Orniel B. Delos Reyes, REE, MSEE


Electrical Engineering Department
College of Engineering and Architecture (CEA)
University of Science and Technology of Southern
Philippines (USTsP)
PART II
TIME SERIES ANALYSIS,
FORECASTING AND
CONTROL
COMPONENTS OF A TIME SERIES
 1. TREND: gradual upward or downward
movement of the data over time.
 2. SEASONALITY: data pattern that repeats itself
after a period of hours, days, weeks or months or
even years
 3. CYCLES: pattern of data that occur every several
years and usually tied to business cycles.
 4. RANDOM VARIATIONS: are “blips” in the data
caused by random and chance conditions.
COMMON SEASONALITY PATTERNS
 PERIOD “SEASON LENGTH” NUMBER OF
 SEASONS
 Week Day 7
 Month Week 4-4.5
 Month Day 28-31
 Year Quarter 4
 Year Month 12
 Year Week 52
QUANTITATIVE METHODS
 NAÏVE APPROACH: Simplest way to forecast is to
assume that the demand in the next period will be
equal to the demand in the most recent period. It
turns out that some products are best predicted by
the naïve approach. It is also called a ‘random
walk” or “white noise” process.
 Provides a starting point against which more
sophisticated models can be compared.
Quantitative Forecasting
Models
 Time Series Method
 Naïve
 Whatever happened
recently will happen again
this time (same time
Ft = Yt −1
period)
 The model is simple and
flexible
 Provides a baseline to
Ft = Yt − 4 : Quarterly data
measure other models
Ft = Yt −12 : Monthly data
 Attempts to capture
seasonal factors at the
expense of ignoring trend
Naïve Forecast
Wallace Garden Supply
Forecasting
Storage Shed Sales

Actual Naïve Absolute Percent Squared


Period Value Forecast Error Error Error Error
January 10 N/A
February 12 10 2 2 16.67% 4.0
March 16 12 4 4 25.00% 16.0
April 13 16 -3 3 23.08% 9.0
May 17 13 4 4 23.53% 16.0
June 19 17 2 2 10.53% 4.0
July 15 19 -4 4 26.67% 16.0
August 20 15 5 5 25.00% 25.0
September 22 20 2 2 9.09% 4.0
October 19 22 -3 3 15.79% 9.0
November 21 19 2 2 9.52% 4.0
December 19 21 -2 2 10.53% 4.0
0.818 3 17.76% 10.091
BIAS MAD MAPE MSE

Standard Error (Square Root of MSE) = 3.176619


Naïve Forecast Graph
Wallace Garden - Naive Forecast

25

20

15
Sheds

Actual Value
Naïve Forecast
10

0
February March April May June July August September October November December
Period
Moving Averages
 A moving average forecast uses a number of
historical data values to generate a forecast. It is
useful if we make the assumption that market
demands will stay fairly stable and steady over time
(no trends, too much fluctuations etc.)
 An n-period moving average equals:
 MA = (Sum of demand in past n periods)/n
 Moving averages tend to smooth out fluctuations
and will therefore be useless in detecting real
changes in the data.
Quantitative Forecasting
Models
 Time Series Method
 Moving Averages
 Assumes item forecasted
will stay steady over time.
 Technique will smooth out
short-term irregularities in
the time series.

k
k - period moving average =  (Actual value in previous k periods) /k
k =1
Moving Averages
Wallace Garden Supply
Forecasting
Storage Shed Sales

Actual
Period Value Three-Month Moving Averages
January 10
February 12
March 16
April 13 10 + 12 + 16 / 3 = 12.67
May 17 12 + 16 + 13 / 3 = 13.67
June 19 16 + 13 + 17 / 3 = 15.33
July 15 13 + 17 + 19 / 3 = 16.33
August 20 17 + 19 + 15 / 3 = 17.00
September 22 19 + 15 + 20 / 3 = 18.00
October 19 15 + 20 + 22 / 3 = 19.00
November 21 20 + 22 + 19 / 3 = 20.33
December 19 22 + 19 + 21 / 3 = 20.67
Moving Averages Forecast
Wallace Garden Supply
Forecasting 3 period moving average
Actual Value - Forecast

Input Data Forecast Error Analysis


Absolute Squared Absolute
Period Actual Value Forecast Error error error % error
Month 1 10
Month 2 12
Month 3 16
Month 4 13 12.667 0.333 0.333 0.111 2.56%
Month 5 17 13.667 3.333 3.333 11.111 19.61%
Month 6 19 15.333 3.667 3.667 13.444 19.30%
Month 7 15 16.333 -1.333 1.333 1.778 8.89%
Month 8 20 17.000 3.000 3.000 9.000 15.00%
Month 9 22 18.000 4.000 4.000 16.000 18.18%
Month 10 19 19.000 0.000 0.000 0.000 0.00%
Month 11 21 20.333 0.667 0.667 0.444 3.17%
Month 12 19 20.667 -1.667 1.667 2.778 8.77%
Average 12.000 2.000 6.074 10.61%
Next period 19.667 BIAS MAD MSE MAPE
Moving Averages Graph
Three Period Moving Average

25

20

15
Value

Actual Value
Forecast

10

0
1 2 3 4 5 6 7 8 9 10 11 12
Time
SAMPLE COMPUTATIONS
 MONTH ACTUAL SALES 3-MONTH M.A.
 January 10
 February 12
 March 13
 April 16 11.67
 May 19 13.67
 June 23 16
 July 26 19.33
 August 30 22.67
 September 28 26.33
 October 18 28
 November 16 25.33
 December 14 20.67
Quantitative Forecasting
Models
◼ Time Series Method
 Weighted Moving Averages
◼ Assumes data from some periods are more
important than data from other periods (e.g.
earlier periods).
◼ Use weights to place more emphasis on some
periods and less on others.

k - period weighted moving average =


k k

 (Weight for each period i)(Actual value in previous k periods) /  (weights)


i =1 i =1
Weighted Moving Average
Wallace Garden Supply
Forecasting
Storage Shed Sales

Actual
Period Value Weights Three-Month Weighted Moving Averages
January 10 0.222
February 12 0.593
March 16 0.185
April 13 2.2 + 7.1 + 3 / 1 = 12.298
May 17 2.7 + 9.5 + 2.4 / 1 = 14.556
June 19 3.5 + 7.7 + 3.2 / 1 = 14.407
July 15 2.9 + 10 + 3.5 / 1 = 16.484
August 20 3.8 + 11 + 2.8 / 1 = 17.814
September 22 4.2 + 8.9 + 3.7 / 1 = 16.815
October 19 3.3 + 12 + 4.1 / 1 = 19.262
November 21 4.4 + 13 + 3.5 / 1 = 21.000
December 19 4.9 + 11 + 3.9 / 1 = 20.036

Next period 20.185

Sum of weights = 1.000


Weighted Moving Average
Wallace Garden Supply
Forecasting 3 period weighted moving average

Input Data Forecast Error Analysis


Absolute Squared Absolute
Period Actual value Weights Forecast Error error error % error
Month 1 10 0.222
Month 2 12 0.593
Month 3 16 0.185
Month 4 13 12.298 0.702 0.702 0.492 5.40%
Month 5 17 14.556 2.444 2.444 5.971 14.37%
Month 6 19 14.407 4.593 4.593 21.093 24.17%
Month 7 15 16.484 -1.484 1.484 2.202 9.89%
Month 8 20 17.814 2.186 2.186 4.776 10.93%
Month 9 22 16.815 5.185 5.185 26.889 23.57%
Month 10 19 19.262 -0.262 0.262 0.069 1.38%
Month 11 21 21.000 0.000 0.000 0.000 0.00%
Month 12 19 20.036 -1.036 1.036 1.074 5.45%
Average 1.988 6.952 6.952 10.57%
Next period 20.185 BIAS MAD MSE MAPE

Sum of weights = 1.000


Weighted Moving Averages
 Weights can be used to place more emphasis on recent
values than on past values:
 Weighted MA
 = Sum(weight for periodn) x (demand in period n) / Sum (weights)

 For example if the weights: 3, 2, 1 are used then:


 Weighted MA
 = (3 x Present data + 2 x Immediate Past + 1 x Immediate Past Two data)/6
WEIGHTED MOVING AVERAGE SAMPLE
 MONTH ACTUAL SALES 3-MONTH M.A.
 (Weighted)*
 January 10
 February 12
 March 13
 April 16 12 1/6
 May 19 14 1/3
 June 23 17
 July 26 201/2
 August 30 23 5/6
 September 28 27 1/2
 October 18 28 1/3
 November 16 23 1/3
 December 14 18 2/3

 Weights: 3, 2, 1
NOTES ON MOVING AVERAGES
 1. Moving averages cannot pick up trends very well.
Because they are averages, they will always stay
within past levels and will not predict changes to
either higher or lower levels. That is, they lag the
actual values.
 2. Moving averages require extensive record of past
data.
 3. Increasing the size of n smooth out fluctuations
better but makes the method insensitive to real
changes in the data.
EXPONENTIAL SMOOTHING
 Exponential smoothing is a sophisticated weighted moving
average forecasting method. The basic exponential
smoothing formula is given by:

 New forecast = last period’s forecast +α (last period actual – last


period forecast)

 Here, α is called a weight or a smoothing constant chosen


between 0 and 1. Mathematically:

 F(t) = F(t-1) + α (A(t-1) – F(t-1))


Quantitative Forecasting
Models
 Time Series Method
 Exponential Smoothing
 Moving average technique that requires little record keeping
of past data.
 Uses a smoothing constant α with a value between 0 and 1.
(Usual range 0.1 to 0.3)

Forecast for period t =


forecast for period t - 1 +  (actual value in period t - 1 - forecast for period t - 1)
Exponential Smoothing Data
Wallace Garden Supply
Forecasting
Storage Shed Sales

Exponential Smoothing
Actual
Period Value Ft α At Ft Ft+1
January 10 10 0.1
February 12 10 + 0.1 *( 10 - 10 ) = 10.000
March 16 10 + 0.1 *( 12 - 10 ) = 10.200
April 13 10 + 0.1 *( 16 - 10 ) = 10.780
May 17 11 + 0.1 *( 13 - 11 ) = 11.002
June 19 11 + 0.1 *( 17 - 11 ) = 11.602
July 15 12 + 0.1 *( 19 - 12 ) = 12.342
August 20 12 + 0.1 *( 15 - 12 ) = 12.607
September 22 13 + 0.1 *( 20 - 13 ) = 13.347
October 19 13 + 0.1 *( 22 - 13 ) = 14.212
November 21 14 + 0.1 *( 19 - 14 ) = 14.691
December 19 15 + 0.1 *( 21 - 15 ) = 15.322
Exponential Smoothing
Wallace Garden Supply
Forecasting Exponential smoothing

Input Data Forecast Error Analysis


Absolute Squared Absolute
Period Actual value Forecast Error error error % error
Month 1 10 10.000
Month 2 12 10.000 2.000 2.000 4.000 16.67%
Month 3 16 10.838 5.162 5.162 26.649 32.26%
Month 4 13 13.000 0.000 0.000 0.000 0.00%
Month 5 17 13.000 4.000 4.000 16.000 23.53%
Month 6 19 14.675 4.325 4.325 18.702 22.76%
Month 7 15 16.487 -1.487 1.487 2.211 9.91%
Month 8 20 15.864 4.136 4.136 17.106 20.68%
Month 9 22 17.596 4.404 4.404 19.391 20.02%
Month 10 19 19.441 -0.441 0.441 0.194 2.32%
Month 11 21 19.256 1.744 1.744 3.041 8.30%
Month 12 19 19.987 -0.987 0.987 0.973 5.19%
Average 2.608 9.842 14.70%
Alpha 0.419 MAD MSE MAPE

Next period 19.573


Exponential Smoothing
Exponential Smoothing

25

20

15
Sheds

Actual value
Forecast

10

ary ary rch ril y ne ly st er er be


r
be
r
Ap Ma Ju Ju gu mb tob
J anu bru Ma Au te Oc v em c em
Fe Se
p No De
EXAMPLE: exponential smoothing
 In January, the NPC predicted February water level
to be at 8.3m. The actual February water level is 10.7
m. A constant chosen by management to be a = 0.20
was used to predict March level at:

 March level = 8.3 + (.2)( 10.7 – 8.3)


 = 9.18 m
Notes on the Smoothing Constant
 1. The smoothing constant is generally in the range
between 0.01 to 0.90. It can be changed to give
more weight to recent data (higher values of the
constant) or to give more weight to past data
(lower values of the constant).
 2. When the constant is 1, the forecasted value
equals the most recent data or the naïve model.
 3. The optimal smoothing constant can be
obtained by a search algorithm.
Activity 2
PERFORM THE FOLOWING:
Using the available data sets (type A,B, and C)
construct a ten-period prediction or forecasts using:
 Moving averages (try several n for lesser error of MAD,
MSE, and MAPE)
 Weighted Moving Average (try several n and 3,2,1
weights for lesser error of MAD, MSE, and MAPE)
 Exponential smoothing (try several values of the
smoothing constant for lesser error of MAD, MSE, and
MAPE)
 MAKE A REPORT OF YOUR FINDINGS AND
JUSTIFY YOUR METHOD OF FORECASTING
DATA SETS:kwh sales from April 2004 to July 2005
by customer type
 Type A Type B Type C
 12086460 1172847 4116616
 12685535 1168913 4399389
 12323860 1192800 4372328
 12643188 1138988 4578536
 12439994 1159725 4559700
 12083391 1181775 4439149
 11946914 1063650 4440127
 12617985 1093575 4543141
 12948300 1191750 4533303
 13016985 1110900 4825846
 11700960 1086488 3793421
 12336002 1001438 4086274
 13271061 1098038 4390669
 15221098 1129538 5201763
 13230850 1180200 5159628
 13056365 1118250 4907179

You might also like