Professional Documents
Culture Documents
Time Series A Level Notes (Precision Academy) .
Time Series A Level Notes (Precision Academy) .
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
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
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.
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
This table is used to draw the 3-point moving average trend line (3-point moving average
smoothed line)
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
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
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
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.
11
PRECISION ACADEMY +263775973880 CREATED BY MWEDZI SOLOMON
Solution
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.
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)
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
Example
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.
̅ ̅
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
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
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
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
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)
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
Autumn 330
Summer 90
Autumn 390
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
,
23