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

SEMINAR ON TIME SERIES: GUMBONZVANDA HIGH SCHOOL

OBJECTIVES: After studying this topic students should be able to


 define time series key terms
 identify the components of time series
 draw time series graphs and trend lines
 identify trends
 explain the purpose of smoothening
 calculate moving averages
 Plot moving average graphs
 solve problems involving time series

TIME SERIES
 Time series can be defined as a series of data recorded and analysed in a time order, at
equally spaced time periods (e.g., per year, month, day, hour)
OR: Time series is a sequence of data points recorded at successive equally spaced points in
time.
OR: Time series is a set of statistical data arranged in chronological order.
OR: Time series is a data set that tracks a sample over time.
OR: A time series is a sequence of observations measured at successive times. Time series
are monthly, trimestral, or yearly, weekly, daily, or hourly (e.g. study of road traffic; sales),
COMPONENTS OF TIME-SERIES:
A time series can have one or more of the following four components:
a) Secular trend or Trend component:
 A trend is long-term increase or decrease in the data which might not be linear.
Sometimes the trend might change direction as time increases.
 A trend exists when there is a long-term increase or decrease in the dependent variable
as time passes. An example of a trend would be a long term increase in a company’s
sales data or network usage.
Fig 1 shows the diagram of a linear trend

Fig 1

b) Seasonal component: exists when a series exhibits regular fluctuations based on the
season (e.g. every month/quarter/year).Seasonality is always of a fixed and known
period.
 A seasonal trend or pattern occurs when a time series is affected by seasonal
factors such as the time of the year or the day of the week.
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

 Seasonality occurs if there are regular and predictable fluctuations in the series
that are correlated with the calendar – could be quarterly, weekly, or even days of
the week, then the series includes a seasonality component. For example in
Zimbabwe winter clothing sales are usually higher in the winter season and low in
summer season.
Fig 2 shows the diagram of sales of smart phones that has Seasonal pattern.
Fig 2

Every year the sales are


increasing in the last
quarter

c) Cycle Component: exists when data exhibit rises and falls that are not of fixed period.
The average length of cycles is longer than the length of a seasonal pattern.
 Cyclic trend refers to repeating or oscillating periods that are not related to the
calendar. These includes business cycles such as economic downturns or
expansions, but aren’t related to the calendar in the weekly, monthly, or yearly
sense.
 Cycle patterns correspond to periodical but not seasonal variations;
In a cycle time series the graph oscillates as show in fig 3

Fig 3

d) Irregular variation
Irregular patterns are totally unpredictable. The irregular variations are mainly due to
flood, draughts, famines, earthquakes, etc.
The irregular variation usually occurs in the midst of another variation (either a secular
trend or seasonal trend or cyclic trend).
Fig 4 shows the diagram of a time series that has an irregular pattern.

2
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Fig 4

The diagram below shows the patterns of 4 different components of time series

Fig 5

TIME SERIES PLOT


It is a graph in which time is displayed as the independent variable along the x-axis and the other
variable being measured along the y-axis.
Data points are plotted and connected with straight lines.

Example 1:
The table below shows the sales of a shop which were recorded over a two-week period.
week Day Sales
($)
1 Monday 162
Tuesday 143
Wednesday 138
Thursday 138
Friday 149
Saturday 204
Sunday 90
``2 Monday 155
Tuesday 130
Wednesday 123
Thursday 132
Friday 142
Saturday 200
Sunday 88
Using the information above draw a time series graph of the sales.

3
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Solution
The days are to be sequentially coded as day 1, day 2, day 3 etc. starting with the 1st Monday as day 1
and end with last Sunday as day 14

200

190

180

170

160

150
SALES

140

130

120

110

100

90

80
0 2 4 6 8 10 12 14 16
DAY

DATA SMOOTHENING
Data smoothing can be defined as a statistical approach of eliminating outliers from datasets to
make the patterns more noticeable.

4
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

 All components excluding secular trend are uneven (not smooth). Data smoothing is done
by using different smoothing techniques to remove such irregularities or noise from a
data set.
 Noise: All-time series data will have noise or haphazardness in the data points that aren’t
correlated with any explained trends. Noise is unsystematic and is short term.
 The smoothening process levels out the irregular roughness to see a clearer signal. For
seasonal data, we might smooth out the seasonality so that we can identify the trend.
Benefits of Data Smoothing
 It can help in identifying trends in businesses, financial securities, and the economy.
 Data smoothing can help expose patterns in complicated data. It assists in the prediction of
the usual direction of the next observed data point. If users do not need certain data points,
data smoothening eliminates the data points if they are of no interest to the user.
 It also helps to generate smooth graphs that depict trends and patterns.

Limitations of Data Smoothing


 Data smoothing does not necessarily offer an interpretation of the themes or patterns it helps
to recognize.
 It can also contribute to certain data points being overlooked by focusing on others.
 Sometimes, data smoothing may eliminate the usable data points. It may lead to incorrect
forecasts if the data set is seasonal and not completely be reflective of the reality produced by
the data points.
 Moreover, data smoothing can be prone to considerable disruption from the outliers in the
data.

METHOD OF SMOOTHENING DATA.


Moving Average.
The moving average is a statistical approach of smoothening data in a time series which involves
taking an average of a set of numbers in a given range while moving the range.
NB: Finding the moving average is finding the mean of the data points.

Example 2
Moving Average Smoothing with an Odd Number of Points E.g. 3 point MA; 5 point MA; 7
point MA; etc.
The number of babies born in a remote hospital over the period 1996 to 2005 is given below.

Year 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
Number of 25 18 23 21 19 20 18 16 17 15
birth

a) Draw the time series graph of the number of babies born and calculate the 3-point
moving average.
b) Draw the 3-point moving average on the time series graph.

5
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Solution

The years can be sequentially coded as year 1, year 2, year 3 etc. starting with 1996 as year 1 as
shown in the table below.

To calculate a three point moving average the following steps are followed:

 Add up the data from year 1 (1996), year 2 (1997) and year 3 (1998)
 Divide by three
 List the answer next to the data from the ‘middle’ year (year 2 (1997))
 Repeat the process, this time exclude the first year (1996) from the first calculation
and include the fourth year (1999) .
 Repeat for all months
Year Year Number (t) No of Moving Averages
births (y)
1996 1 25

1997 2 18

1998 3 23

1999 4 21

2000 5 19

2001 6 20

2002 7 18

2003 8 16

2004 9 17

2005 10 15
Year number 1 2 3 4 5 6 7 8 9 10
Number of birth 25 18 23 21 19 20 18 16 17 15
This table is the used to draw the time series plot

In order to draw a trend line of 3-point moving average, each moving average point must be
aligned with the midpoint of the range of years that it includes eg 22 is the average of [year 1;
6
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

year 2 and year 3] therefore year 2 is the midpoint in that range. Hence the coordinate to be
plotted is

Year Number (t) 2 3 4 5 6 7 8 9


3-point MA 22 20.7 21 20 19 18 17 16

This table is used to draw the 3-point moving average trend line (3-point moving average
smoothed line)

The trend above shows a general decrease of babies being born.

Moving Average smoothing with an Even Number of Points e.g. 2 point MA; 4 point MA; 6
point MA etc.

Example 3
The number of babies born in a remote hospital over the period 1996 to 2005 is given below.
Year 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
Number of birth 25 18 23 21 19 20 18 16 17 15

a) Calculate the 4-point moving average

7
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Solution
Year Year No of births Moving Averages
Number (t) (y)
1996 1 25

1997 2 18

1998 3 23

1999 4 21

2000 5 19

2001 6 20

2002 7 18

2003 8 16

2004 9 17
2005 10 15
In a table above each moving average point is not lined up with a specific year.

NB: In every Moving Average with an Even Number of Points; each moving average point
does not line up with a specific year or week or day etc because the midpoint is not specific (not
a whole number).

In order to draw a trend line of 4-point moving average, each moving average point must be
aligned with its year which is not specific as shown in the table below.
Year no (t) 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9
4-point MA

The 4-point moving average trend is drawn after plotting the points from the table below.

8
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Year Number (t) 2.5 3.5 4.5 5.5 6.5 7.5 8.5
4-point MA

CENTERED MOVING AVERAGE.

The centered moving average technique is embraced when dealing with a Moving Average with
an Even Number of Points e.g. 2 point MA; 4 point MA etc.

Centering ensures that each moving average in a Moving Average with an Even Number of
Points is aligned to a specific year or week or day (time variable) etc.

Example 4

Year 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
Number of birth 25 18 23 21 19 20 18 16 17 15

a) Calculate the 4-point moving average and the centered moving average
b) Draw the time series plot and the centered moving average trend line

9
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Solution

Year Year No of 4-point MA Centered MA


Number (t) births (y)
1996 1 25

1997 2 18

1998 3 23

1999 4 21

2000 5 19

2001 6 20

2002 7 18

2003 8 16

2004 9 17
2005 10 15

The centered MA trend is drawn after plotting the points from the table below.
Year Number (t) 3 4 5 6 7 8
Centered MA 20.5 20.125 18.875 18 17.125

10
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

FORECASTING
 Time series forecasting method involves projection of future values of a variable based
entirely on the past and present observation of that variable.
 Method of Least Squares (linear trend forecasting) is of one the methods used for
forecasting
 Linear trend can be used as a means of analysing historic data so that forecasts can be
made for the future
Method of Least Squares Least Square
 Method of Least Squares Least Square is the method for finding trend line of best fit to a
time series data.
 This line is termed as the line of best fit from which the sum of squares of the distances
from the points is minimized.

Line of best fit (linear trend)

Linear trend line Y is defined by the following equation: ; where Y = predicted


value of the dependent variable; a = Y-axis intercept and b = gradient of the line.
When b is positive the slope is upwards, when b is negative, the slope is downwards
(In this case it is time)

Example on Method of Least Squares


The annual TV sales at Chiripi shop for past 5 years.
Year 2006 2007 2008 2009 2010
Sales of T.V(in 000) 12 18 20 23 27

a) Fit a trend line to the data.


b) Forecast the sales for the year 2012.

11
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Solution

FORECASTING CAN BE COMPUTED USING TWO METHODS

METHOD 1

The years can be sequentially coded as year 1, year 2, year 3 etc. starting with 2006 as year 1 and
they are labelled as X variables whilst the sales are labelled as Y variables.

NB: A trend line to the data is a regression line of y on x.

a)
Year Sales

̅ ̅

Therefore

b) If the years are sequentially coded as year 1, year 2, year 3 and so on from 2006. 2012
becomes year 7 meaning that in 2012, . Therefore X is substituted by 7 to find
the value of Y (2012 sales)

Thus the likely sale of T.V in 2012 will be 34 000.

12
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

40

35
34

30

25
Y (SALES)

20

15

10

0
0 1 2 3 4 5 6 7
X (YEAR NUMBER)

 Looking closely at the data, it is clear that although the line of best fit (black line) is
linear, the actual data time plot (Red line) fluctuates around this line. In some years the
sales are above the trend line, in others the sales are below it.
 The scatter plot cannot go beyond year 5 (2010) based on the data but the line
can go beyond year 2010, therefore it can be used to predict any year
ahead of 2010.
 The gap between the actual data and the trend line is known as the SEASONAL
VARIATION.

13
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

METHOD 2
a) This method ensures that
b) NB: If the number of years or days is odd; ascribed 0 to the middle year then
sequentially code the previous years as . Again sequentially code
subsequent years as . In this question the middle year is 2008 and is coded
0.

̅ ̅
Therefore
c) If the years are sequentially coded as year , year , year and so on from 2006. 2012
becomes year 4 meaning that in 2012, . Therefore X is substituted by 4 to find the
value of Y (2012 sales)
Thus the likely sale of T.V in 2012 will be 34 000.
35
34

30

y =20+ 3.5x
25
y

20

15

10
-2 -1 0 1 2 3 4
x

14
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

USING THE SECOND METHOD TO FORECAST WHEN THE NUMBER OF YEARS


IS EVEN.

Example

Year(x) 1961 1962 1963 1964 1965 1966 1967 1968


Value (y) 80 90 92 83 94 99 92 104

Find the y value for the year 1970

Solution

The number of years is even so there is no single specific middle year. The middle years are
1964 & 1965. -1 is allocated to 1964 and 1 is allocated to 1965. From -1 (1964) subtract 2 units
to get the value for 1963; the same pattern of subtracting 2 units is used until the value of the first
year is obtained.

From 1 (1965) add 2 units to get the value for 1966; the same pattern of adding 2 units is used
until the value of the last year is obtained.

year 1961 1962 1963 1964 1965 1966 1967 1968


Year no (x) -7 -5 -3 -1 1 3 5 7
Value (y) 80 90 92 83 94 99 92 104

̅ ̅

The x value for 1970 is 11 therefore,

SEASONAL VARIATION

 Can be described as the difference between the trend of data and the actual figures for the
period in question.

15
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

 A seasonal variation can be a numerical value (additive) or a percentage


(multiplicative). The term ‘seasonal’ is applied to a time period, not necessarily a
traditional season (summer, autumn etc.).

Or

Or –

Example
The following data is a series of data representing sales of a product in units over a 12 months
period.

Calculate the three point moving average for the data and

a) The seasonal variations using the additive model


b) The seasonal variations using the multiplicative model

Solution
a) Additive model

16
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

The negative variation means the actual value is below the trend whilst the positive variation
means the actual value is above the trend.

b) Multiplicative model.
The variation is expressed as a percentage of the average figure

Month Actual data 3 point MA Seasonal variation


January 4680
February 2970 3420 87%
March 2610 3510 74%
April 4950 3600 138%
May 3240 3690 88%
June 2880 3780 76%
July 5220 3870 135%
august 3510 3960 89%
September 3150 4050 78%
October 5490 4140 133%
November 3780 4230 89%
December 3420
This means that February`s sales is usually 87% of the trend; March is 74%, April is 138% etc.
The multiplicative model is better method to use when the trend is increasing or decreasing over
time, as the seasonal variation will also likely to be increasing or decreasing.

Practice Questions
1. Zimsec Past Exam question:
The table below shows the sales of a shop which were recorded over a two-week period.

17
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Week Day Sales


($)
1 Monday 162
Tuesday 143
Wednesday 138
Thursday 138
Friday 149
Saturday 204
Sunday 90
2 Monday 155
Tuesday 130
Wednesday 123
Thursday 132
Friday 142
Saturday 200
Sunday 88
a) Using the information above draw a time series graph of the sales. [3]
b) Calculate the 7 day moving average correct to the nearest whole number. [4]
c) Plot the moving averages on your time series and draw a trend line through the points.[3]
d) The seasonal component on Monday is 14.2. Estimate the sales realized by the shop on
Monday of week 3. [6]

SOLUTION
The days are to be sequentially coded as day 1, day 2, day 3 etc. starting with the 1st Monday as day 1
and end with last Sunday as day 14
a) ;b) and c)

Week day Sales 7 point MA


1 162
2 143
1 3 138
4 138 146
5 149 145
6 204 143
7 90 141
8 155 140
9 130 139
2 10 123 139
11 132 139
12 142
13 200
14 88

18
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

210

200

190

180

170

160

150
SALES

140

130

120

110

100

90

80
0 2 4 6 8 10 12 14 16
Day

19
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

d)

X (Day Y (7pnt
Number) MA)
XY
4 146 584 16
5 145 725 25
6 143 858 36
7 141 987 49
8 140 1120 64
9 139 1251 81
10 139 1390 100
11 139 1529 121
60 1132

̅ ̅

Monday of the third week will be day 15 and will have a trend value of

To find the forecast value or the actual value if given the trend value and the seasonal component
(variation) numerically the additive model formula below is used

2. The table gives information about the number of students who enrol for a course in each term
in 2011, in 2012 and in 2013.

20
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

Year Term Number of students

Autumn 330

2011 Spring 180

Summer 90

Autumn 390

2012 Spring 230

Summer 170

Autumn 460
2013 Spring 260
Summer 210

a) Draw a time-series graph for student`s enrollment for the three years.
b) Calculate the 3-point moving averages, giving your answer correct to 3 significant
figures.
c) Plot the 3-point moving averages on the time-series graph and draw the trend line
through those points.
d) Draw the line of best fit and use it to find an estimate for the mean seasonal variation in
numbers enrolling for the Autumn Term.
e) Predict the number of students who will enroll in the Autumn Term of 2014.

21
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

SOLUTION.
a);c);d)
500

450

400

350

310
NO OF STUDENTS

300 297
287

263
250
237
220
200 200

150

100

50

0 A S S A S S A S S A
0 1
U 2P 3 4 5 6 7 8 9 10
U U P U U P U U
2011 2012 2013 TIME 2014

22
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON

b)

Term Number
Term No of students
3-point MA
Autumn 1 330
Spring 2 180 200
Summer 3 90 220
Autumn 4 390 237
Spring 5 230 263
Summer 6 170 287
Autumn 7 460 297
Spring 8 260 310
Summer 9 210

d) Method of least squares is used to draw the trend line of best fit.

X Y
2 200
3 220
4 237
5 263
6 287
7 297

 ,

e) Autumn term of 2014: Trend value is and the

Using the additive model to find the forecast value

23

You might also like