CH - 7 Time Series and Forecasting
CH - 7 Time Series and Forecasting
Chapter 7
2
Time Series
Monthly electricity consumption from January 2014 to December 2020 for Dhaka
4 city. (Source: Istiaque and Khan, 2018)
Components of a Time Series
⚫ Secular Trend
– A type of variation in a time series, in which the value of the
variable tending to increase or decrease over a long period
of time
⚫ Cyclical Variation
– the rise and fall of a time series over periods longer than
one year
⚫ Seasonal Variation
– Patterns of change in a time series within a year which tends
to repeat each year
⚫ Irregular Variation
– A condition in a time series in which the value of a variable is
completely unpredictable
5
Secular Trend
Year 2013 2014 2015 2016 2017 2018 2019
Power Consumption
43.01 48.04 51.86 61.48 65.86 70.31 76.85
(in B. K.Watts)
Cyclical Variation – Sample Chart
7
Seasonal Variation – Sample Chart
8
Identifying the Trend
• Attributes:
• Persistent, overall upward or downward pattern of several years duration
• Due to population, technology etc.
• Trend can be linear or curvilinear
• Free hand trend line is subject to slightly different interpretation
•Reasons for studying trends
• The study of secular trends allows us to describe a historical pattern
• Studying secular trend permits us to project past patterns, or trends, into
the future
• Studying secular trend allows to eliminate the trend component from the
series and thus reveal other components.
•Methods to identify trend
• Graphical Method
• Semi-Averages Method
• Moving Average Method
• Least Squares Method
9
Trend by Graphic Method
Year 2013 2014 2015 2016 2017 2018 2019
Power Consumption
43.01 48.04 51.86 61.48 65.86 70.31 76.85
(in B. K.Watts)
Trend by Semi-Average Method
Average Average
⚫ For even numbers of data, divide the data into two equal part.
Calculate arithmetic mean of each part. Plot them and then
connect the points.
⚫ For odd numbers of data, ignore the middle value and then do as
above. Average Average
12
Trend by Moving Average Method
12.0
2007 16.8 18.1
10.0
2008 21.4 19.9 2006 2007 2008 2009 2010
4 Sales ($ millions)
3 Years Moving Average
7 Years Moving Average
3
15
Linear Trend by Least square method
a − the Y - intercept
(estimated value of Y when t = 0)
17
Linear Trend Plot
18
Linear Trend – Using the Least
Squares Method
19
Linear Trend – Using the Least Squares
Method: An Example
Sales Sales
Year ($ mil.) Year t ($ mil.)
2002 7 2002 -2 7
2003 10 2003 -1 10
2004 9 2004 0 9
2005 11 2005 1 11
2006 13 2006 2 13
20
Sales
Year t ($ mil.)
2002 -2 7
2003 -1 10
2004 0 9
2005 1 11
2006 2 13
21
Linear Trend – Using the Least Squares
Method: An Example Using Excel
22
Fitting the Linear Trend
(Least Square Method)
b=
XY − n X Y
X − nX
2 2
INTERCEPT :
a = Y −bX
Fitting the Linear Trend
(Least Square Method)
⚫ Here
X = values of the independent variable
Y= values of dependent variable
X = mean of the values of independent variable
= mean of the values of dependent variable
Y
a = Y- intercept
b = slope
Y = estimated value of the dependent variable
Fitting the Linear Trend
(Least Square Method)
Year Power Consumption
X Y XY x2
2000 11.04 22080 4000000
2001 11.22 22451 4004001
2002 12.55 25125 4008004
2003 14.26 28563 4012009
2004 14.25 28557 4016016
2005 15.3 30677 4020025
2006 16.2 32497 4024036
2007 16.82 33758 4028049
2008 21.37 42911 4032064
2009 21.37 42932 4036081
2010 21.38 42974 4040100
2011 23.94 48143 4044121
2012 23.94 48167 4048144
X = 2006 Y= 17.20 XY = 448835 = 52312650
X 2
n= 13
Fitting the Linear Trend
(Least Square Method)
⚫ Slope, b = 1.172582
⚫ Intercept , a = -2334.997
⚫ Forecast for 2015 : 27.76 B. KWh
Fitting the Linear Trend
(Least Square Method) – Simplified
Calculation
Slope :
b=
xY
and
x 2
INTERCEPT :
a =Y
Fitting the Linear Trend
(Least Square Method) – Simplified Calculation – Odd
# of data
n= 7
Fitting the Linear Trend
(Least Square Method)- Simplified (odd # of
data)
⚫ Slope, b = 16.71429
⚫ Intercept , a = 145.14
⚫ Linear equation,
Estimated Y = 145.14 + 16.71429x,
where x = (X - 1992)
⚫ What will be the forecast for year 1996?
Fitting the Linear Trend
(Least Square Method) – Simplified Calculation – Even
# of data
Power
Year Consumption
X X-X bar x=2 * (X-Xbar) Y xY x2
1988 -3.5 -7 98 -686 49
1989 -2.5 -5 105 -525 25
1990 -1.5 -3 116 -348 9
1991 -0.5 -1 119 -119 1
1992 0.5 1 135 135 1
1993 1.5 3 156 468 9
1994 2.5 5 177 885 25
1995 3.5 7 208 1456 49
0 0
X = 1991.5
n= 8
xi = 0 Y = 139.25 XY = 1266 X 2
= 168
Fitting the Linear Trend
(Least Square Method)- Simplified (Even # of
data)
⚫ Slope, b = 7.535714
⚫ Intercept , a = 139.25
⚫ Linear equation,
Estimated Y = 139.25 + 7.536x,
where x = 2 * (X - 1991.5)
⚫ What will be the forecast for year 1996?
32
Quadratic (Second-Degree Trend)
Time-Series Forecasting Model
Y = a + b x + cx 2
Quadratic Time-Series
Model Relationships
Y C>0 Y C>0
Year, X1 Year, X1
Y C<0 Y C<0
Year, X1 Year, X1
Quadratic Trend Model
When _ x = ( X − X ) _ and _ xi = 0
Y = an + c x 2
x Y = a x + c x
2 2 4
b=
xY
x 2
Quadratic Trend Model
Y X X-Xbar x=(X-Xbar)*2 x^2 x^4 xY x^2.Y
2 94 -2.5 -5 25 625 -10 50
5 95 -1.5 -3 9 81 -15 45
2 96 -0.5 -1 1 1 -2 2
2 97 0.5 1 1 1 2 2
7 98 1.5 3 9 81 21 63
6 99 2.5 5 25 625 30 150
0 0 0 0
0 0 0 0
0 0 0 0
24 96.5 Sum 70 1414 26 312
6
Equation 1: 6a + 70c = 24
Equation 3: b= 0.371(approx)
a= 3.375(approx)
c= 0.054(approx)
Seasonal Variation
37
Seasonal Index
The table below shows the quarterly sales for Toys International for the
years 2001 through 2006. The sales are reported in millions of
dollars. Determine a quarterly seasonal index using the ratio-to-
moving-average method.
39
Step (1) – Organize time series data
in column form
Step (2) Compute the 4-quarter
moving totals
Step (3) Compute the 4-quarter
moving averages
Step (4) Compute the centered
moving averages by getting the
average of two 4-quarter moving
averages
Step (5) Compute ratio by dividing
actual sales by the centered
moving averages
40
Seasonal Index – An Example
41
Actual versus Deseasonalized Sales
for Toys International
Deseasonalized Sales = Sales / Seasonal Index
42
Actual versus Deseasonalized Sales for Toys
International – Time Series Plot using Minitab
43
Seasonal Index – An Excel Example
using Toys International Sales
44
Forecasting– An Example Using Excel
Ŷ Quarterly Forecast
(unadjusted Seasonal (seasonally adjusted
Quarter t forecast) Index forecast)
Winter 25 10.35675 0.765 7.923
Ŷ X SI = 10.62648 X 1.519
Ŷ = 8.109 + 0.0899(28)
45
END OF CHAPTER 16
46