Time Series Notes
Time Series Notes
1.0 INTRODUCTION
A time series is an ordered sequence of values of a variable at equally spaced time intervals. It
is a set of data values that are recorded at successive and regular intervals over a period of time
e.g., daily, weekly, monthly, quarterly and annually.
An analysis of history, a time series, can be used by management or business individuals to make
current and future plans based on long term time series data, and assuming that patterns would
continue into the future. Both short-term and long-term predictions are essential for a business
entity to execute possible development plans in terms of financing, procurement, manufacturing,
sales, profits, revenue, new products, new plants/machinery, market demand, and recruitment
among others.
For forecasts based on time series to be meaningful, the rule of thumb is that the data must
recorded over a relatively longer period of time i.e., at least 10 observations.
1.1 APPLICATIONS OF TIME SERIES
The analysis of time series has two major objectives;
a) Obtain an understanding of the underlying forces and structure that produced the observed
data.
b) Forecast using fitted time series model. The models can also be used to monitor a set of time
series components.
Time Series analysis areas of application including economic forecasting, sales forecasting,
budgetary analysis, stock market analysis, yield projections, process and quality control,
inventory studies, workload projections, utility studies, and census analysis.
1.2 PLOTTING A TIME SERIES
A time series is plotted on graph called a histogram.
Example 1
The following table shows water consumption (litres) for a typical household in Kisumu.
Construct a time series plot for the data
Solution:
To plot time series data, each data value is plotted against the corresponding time point and the
points are then joined by straight line segments as shown below.
Notice the up and down swings (peaks and troughs) which are typical of time series data. There
is marked seasonality in water consumption with the highest water consumption being in the last
quarter (Oct-Dec) of each year. Over the years, there is a slight increase in water consumption.
1.3 COMPONENTS OF A TIME SERIES
There are four main components to a time series: the secular trend or simply trend, the cyclical
variation, the seasonal variation, and the random variation.
16.3.1 Secular Trend (T):
This is defined as the long-term direction of a time series. The trend can be upward (increasing),
downward (decreasing) or constant (show no change) over time. In the previous example, we
plotted a time series on a histogram and noted that there was a slight increase in water
consumption over the four-year period. We can confirm this observation by fitting in a trend line
in the time series plot as shown below:
We will proceed to find the trend values by adding or subtracting 4.53 to or from either of the
mean points.
For example, the trend for Apr-Jun 2010 is 41.6 – 4.53 = 37.1, for Oct-Dec 2010 is 41.6 + 4.53 =
43.1, and for Apr-June 2012 is 68.8 + 4.53 = 73.3. The rest of the trend values are presented
below.
B. Trend by Least Squares Method
To find the trend using the method of least squares we follow the following steps:
Step 1:
Treat time points as the independent X-variable. The time points are transformed into values
through a process of coding as follows: The first time point is coded 1, the second time point is
coded 2, and so on until the last time point is coded.
Step 2:
Obtain a least squares regression line between the x-codes and the time series data values (Y-
values). The trend line through the data is given by:
To calculate the trend value, substitute the appropriate x-code into the least squares equation and
compute the value of y.
Example 3
Find the trend by means of least squares method for the domestic export data from the previous
example.
Solution
To find the least squares trend, first code the time point as follows: Jan-Mar 2010 – 1, Apr-Jun
2010 – 2, Jul-Sep 2010 – 3, ... Jul-Sep 2012 – 11.
Solution
For 2-point moving averages:
For 3-point moving averages:
Day Data value, y 3-point moving totals 3-point moving average
Day 1 6
Day 2 4 20 6.67
Day 3 10 22 7.33
Day 4 8 23 7.67
Day 5 5 25 8.33
Day 6 12 26 8.67
Day 7 9 28 9.33
Day 8 7 31 10.33
Day 9 15
Note: In a 2-point moving average the moving totals and averages fall between two time points
(days). i.e., the first is between the Day 1 and Day 2 being the median position of the first pair of
figures. The 3-point moving totals and averages fall against/adjacent times points. i.e., the first is
aligned against Day 2 being the median position for the first three figures. Notice that the
resulting moving averages are less variable than the original data. The production figures have
been ‘smoothed’.
The most common moving averages calculated in time series data for commercial purposes are
4-, 5-, 6- or 7-point ones because most data relate to 4 quarter/yearly cycles, and 5, 6 or 7
day/weekly cycles.
TASK 1
The following data shows the sales revenue (K million) of a local company from 2010 to 2013.
Find the trend using the moving average method and plot it together with the time series data.
TASK 2
The following data shows the output of a factory located in Nairobi over a 3-week period.
Find the average seasonal variation for time point. Check that the sum of the average seasonal
variations is equal to zero (0).
If the sum of the averages is not equal to zero, then the averages must be adjusted accordingly
so that they sum to zero. The adjustment factor is
Period
Sum of the averages
. If the sum is less than zero, we add the modulus of the adjustment factor to each average.
However, if the sum is greater than zero, we subtract the adjustment factor from each average to
obtain the adjusted seasonal variations/factors.
Using the multiplicative model:
Obtain the seasonal variation for each time point by dividing the data value by the ‘trend’ i.e.,
Find the average seasonal variation for each time point. Check that the sum of the average
seasonal variations is equal to period. For quarterly data, they must sum to 4, for a 5 day-week,
they must sum to 5. . .
If the sum of the averages does not equal the period, then the averages must be adjusted
accordingly so that their sum equals the period. The adjustment factor is
. The adjusted seasonal variations/factors are then obtained by multiplying each average by the
adjustment factor.
Determining which model to use
The additive model is used when the seasonal variation is approximately the same, irrespective
of the trend values. Consider the graph below;
We can see that the seasonal variations (differences between observed and trend values) for
similar quarters are almost the same. In this case the additive model is appropriate.
In the multiplicative model the season variation is approximately proportional to the trend. If the
trend is upward, then the variation increases. If the trend is downward, then the seasonal
variation decreases.
Consider the following graph:
We can see that the trend is upward and the seasonal variations (differences between observed
and trend (values) for similar quarters are increasing (in absolute terms) as we move from 2010
to 2012. In this case multiplicative model is used.
Apart from the graphical method, the other and quicker method for decide the right model to use
is take the reference between the smallest and largest value for each year (or week). If the
differences are roughly the same or do not follow a particular pattern, then additive model is
appropriate. However, if the differences increasing for an upward trend or decreasing for a
downward trend, then the multiplicative model is appropriate. Consider the data sets whose
graphs we just compared.
Data set 1.
Having subtracted the trend values (T) from the time series values (Y), we must arrange the
differences (i.e., seasonal variations) such that all seasonal variations for similar quarters are in
the same column.
example, for 1st Quarter 2010, the seasonally adjusted value is 79 – 9 = 70 i.e., Ksh 70 million,
and for 2nd Quarter, 2010 is 48 – (-24) = 72 i.e., Ksh 72 million.
The Multiplicative model
In the case of the multiplicative model, seasonally adjusted values are obtained by dividing the
time series values by the respective adjusted seasonal variations:
Adjusted
Add the average trend increase to the last trend values until the required trend estimates are
obtained.
To forecast future values, either add the projected trends to the respective adjusted seasonal
variations (for additive model) or multiply the projected trends with the respective seasonal
variations (for multiplicative model).
Example 7 (Continuation of Example 6)
Using the sales revenue data, the trend and seasonal variations calculated in the previous
examples, forecast the sales revenue for each quarter of 2014 (using the additive model).
Solution:
We first find the average quarterly increase in trend. The average trend increase is (Last trend,
131.8 – first trend, 77.8) divided by number of increments (12 – 1) where 12 is the number of
trends.
Since the last trend, 131.8, corresponds to the Qtr 2, 2013, to find the trend estimate for the first
quarter, Qtr1, of 2014, we need to add 4.9 three times to the 131.8. The projected trend value is
given by
For the remaining quarters of 2014, the projected trend values are:
We proceed to obtain the forecast for each quarter by adding the adjusted seasonal variations as
shown earlier.
Hence, our forecasts for 2014 are: 1st Quarter – Ksh 156 million, 2nd Quarter – Ksh 127 million,
3rd Quarter – Ksh 143 million, and 4th Quarter – Ksh 189 million.
Note
The forecasts assume that there is a linear trend, and that the projection of a linear trend reflects
the future.
The seasonal variations are also assumed to be stable. However, if these assumptions are not
true, then our forecasts are not correct.
Example 8:
The owner of Zathu, a popular restaurant in Lilongwe wishes to study the patterns of customer
numbers for the days of the week in order to be able to forecast activities for the coming days.
He then gathers data on patronage over three weeks as follows.
a) Calculate the trend by using the method of moving averages.
b) Calculate the adjusted seasonal variations assuming the additive model.
c) Forecast the number customer for Monday and Tuesday of Week 4.
d) Calculate the adjusted seasonal variations assuming the multiplicative model.
e) Forecast the number of customers for Monday and Tuesday of Week 4.
Solution:
a) Trend using moving average:
Since the time series is of period 5 and 5 is an odd number, simple 5-point moving averages are
required for the trend. We will add the data values in fives, place the total alongside the median
position and then divide each moving total by 5.
Note
Unlike the moving average method, if the least squares method is used all times point will have
trend values. The procedures for obtaining seasonal variations and forecast are the same as in
moving average method.
ASSIGNMENT 1
1. Briefly describe the components which make up a typical time series
2. The daily output of Mutiko Ltd over a four-week period is shown in the table below:
a) Find the least squares linear trend line. Use the equation to find the trend values for each
quarter for 2010 to 2012.
b) Using the additive model and the trend from part (a), estimate the average seasonal variations
in each quarter (to two decimal places).
c) Deseasonalise the CPI values for 2011.
d) Use your results in (a) and (b) to forecast the CPI for the four quarters of 2013 (to the nearest
whole number). Suggest two reasons why your forecast may not be reliable.
5 The planning department of Bata Shoe has developed the following least squares trend
equation for sales, in thousands of pairs, based on five years quarterly data from 2009.
The following table gives the seasonal variations (SV) for each quarter.