100% found this document useful (1 vote)
207 views38 pages

Lecture 3 - Time Series Analysis - Lecturer

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
207 views38 pages

Lecture 3 - Time Series Analysis - Lecturer

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 38

DATA ANALYSIS, TOOLS AND

APPLICATION (QHO430)

Lecture 3 – Time Series Analysis


Overview

 What is a time series data


 Distinguishing between trend and seasonality
 Use historic time series records to predict future
records.
Time series data
What is a time series data?
This is any series of data for which values are available at regular points in time (hourly, daily,
weekly, monthly, quarterly, annually…)
Although some time series may move in a manner which looks random (e.g., stock market
prices), many exhibit regular patterns

The number of people watching a commercial television channel each hour


Daily takings of a supermarket
Weekly production of cars at a car plant
Monthly values of the Retail Price Index
Quarterly profits of a company
Annual numbers of graduates from the University
What is a time series data?
Time series are used to make forecasts (Predict).
Many business decisions are based on forecasts of future conditions.

For example,
 if data analyst predicts that sales will continue to fall, perhaps a new business
strategy is appropriate.
 if salaries of the company’s current target market are
predicted to fall, perhaps a review of the product range or
a new potential market is necessary.
What is a time series data?
Time series are used to make forecasts (Predict).

The more reliable the forecast the greater the likelihood


of making the ‘best’ decision e.g., larger profits.

Forecasting is ongoing
– as new information is received forecasts are updated
and decisions reviewed and modified.
Types of forecasting
In broad terms there are three types of forecasting.
1. Causal Forecasting
This looks at other variables which are influential.
Example: Using regression analysis and finding an equation giving predicted sales in
terms of advertising expenditure.

2. Projective forecasting
This only uses past values of the variable under consideration.
Example: Using time series of past sales to predict future sales.

3. Judgemental Forecasting
This occurs when there is no numerical data available. Example: Sales of a new product.
Frequency of time series data
A time series data can be collected
Every year Year 2010 2011 2012 2013
Profit (£m) by ABC ltd. 2.3 2.6 3.1 3.3
Every quarter
Quarter Quarter 1 Quarter 2 Quarter 3 Quarter 4
N° of tourists to the UK (million) 3.6 5.2 13.2 4.3
Every month
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Sale of milk (pint) 120 123 133 125 130 132 132 132 133 125 128 128

Or even every day


Daily time series data are particularly interesting if we wanted to know the specific days for high and
low demand for products and services.
Distinction between monetary and non-monetary time series
data
Time series data can be
•Monetary
This data involves money of some sort
Year 2010 2011 2012 2013
Sales in value (£m) 2.3 2.6 3.1 3.3

•Non-monetary
This data involves variables measured in non-monetary units such as N° of
units sold, N° of accidents, N° of members registered students, etc...
Quarter 2013 2014 2015 2016
N° of students recruited by a university 3487 2897 2777 2467
Types of forecasting
We will look at projective forecasting. Week Sales (1000s of litres)
1 17
Example: 2 21
3 19
The table shows the sales of petrol
4 23
over a 12-week period. 5 18
6 16
How could we predict the sales 7 20
for week 13? 8 18
9 22
What methods could we use? 10 20
. 11 15
12 22
Types of forecasting
•Naïve
One possibility could be to use the Week Sales (1000s of litres)
latest value as our forecast. 1 17
Forecast for week 13 = 22 (000 litres) 2 21
3 19
4 23
• Moving average 5 18
We could find the average of the most 6 16
recent values. 7 20
Forecast = Sum of most recent n values 8 18
n 9 22
Suppose we decided to take 10 20
the 3 most recent sales figures 11 15
12 22
Forecast for Week 13 = 20 + 15 +22
3
Forecast for Week 13 = 19 (000 litres)
Types of forecasting
•Weighted Moving Average Week Sales (1000s of litres)
We could decide that the most recent 1 17
sales figures were the most representative. 2 21
So we might choose different weights 3 19
for each data value 4 23
e.g 50% most recent, 5 18
30% second most recent 6 16
20% third most recent 7 20
8 18
Forecast for Week 13 9 22
Recall: 50% = 0.5 10 20
11 15
 0.5  22  0.3  15  0.2  20
12 22
= 19.5 (000 litres)
Types of forecasting
Exponential Smoothing
 This is a type of weighted moving average.
 A smoothing constant (α) between 0 and 1 is chosen.
The larger the value of smoothing constant, the greater the weight on the most
recent figures.
 The new forecast is given by:

New Forecast = Previous Forecast + α * Error in last forecast


Components of a time series
TREND (T) – long-term overall behaviour (upward, downward or constant)

SEASONAL (S) – short-term fluctuations that repeat themselves at fixed


intervals of time (i.e., periodic)

CYCLIC – long period (typically several years) pattern of variation

RANDOM – unpredictable, non-repeating variation

CYCLIC + RANDOM (R) – together are often referred to as residual


variation
Analysis of Time Series

Always start by plotting the data.

This enables you to determine:


 Whether there is a linear or some other type of trend

 Whether there is a regular pattern of seasonal variations, and if so, over how many
periods they repeat

 Whether there are large random variations


Analysis of Time Series
Approximately
constant

Upward Trend
Constant with
seasonal
variation

Upward Trend with Seasonal Upward Trend with Seasonal


Variation (Additive) Variation (Multiplicative)
Annual Time series – Non-monetary
London
Underground  
Passenger
Year journeys (million)
2000 970
2001 953
2002 942
2003 948
2004 976
2005 970
2006 1,040
2007 1,096
2008 1,089
2009 1,059
2010 1,107
2011 1,171 In 2000, the total number of underground journeys stood at around 970 million ,
2012 1,229 dropping steadily to 942 million journeys in 2002. Since then, the number of
2013 1,265 journeys increase reaching a peak of 1096 million journeys in 2007. There has been
2014 1,305 a decline in journeys from 2007 to 2009. Since then, there has been a steady
increase in passenger journeys.
Annual time series
Let us begin by looking at annual time series, that of the average weekly earnings in the UK and how they
have evolved over the last few years.

We can see that earnings (in current prices) are increasing over the years (as they should be), at a
particular rate.
If we want to find the trend for earnings, we want to find the model that best fit.
But first thing first – Draw a line graph on Excel.
Annual time series – Line graph in Excel
The line graph is easy to draw on Excel. To do this quickly, we need to go through the following steps:

1.Click anywhere on the time series data (one cell is sufficient)


2.From the Excel menu, click on “Insert”
3.Choose the line graph type

The described method may not


produce the best result.

Further corrections and


embellishments will be shown in
class.
Annual time series - Trend
The model that fit earnings is found by using the Excel facility “Add Trendline” by right-clicking on any plot.
Daily time series
Sometimes, a time series is available daily. For example, the number of hot drinks sold on each of the working day at
a coffee shop. The line chart for this daily time series shows the following movements:

The demand for coffee is fairly constant at around 200 drinks per day except on Fridays where demand increases to
300 drinks. The regular jump in numbers on Fridays is called the seasonality – Regular pattern.
Trend of the daily time series
The trend (blue dotted line) is fairly flat as it is represented by the 6 points moving averages (see trendline).

It is a six-point moving average because the regularity is every 6 “working” days.


However, predicting the data for future weeks needs to take into account the trend and the seasonality.
Predicting with trend
and seasonality
Predicting time series with trend and seasonality
To predict a time series that display a trend and seasonality on Excel, we need to deploy the
“Forecast Sheet” functionality (See below).

First, click anywhere (any cell) on the time series data (For example this cell).
Click on Data → Forecast Sheet →Create.

Note: This Excel facility may not be available for Apple users.
Predicting time series with trend and seasonality – Graphically
What does the following output represent?

Historical data Future predictions


Predicting time series with trend and seasonality – Numerically
End of prediction

Start of prediction

Historical data

Regularity of the data

Predictions
Time series data – Quarterly
Quarterly data is data that is published 4 times a year
(every three month).

Quarter 1: January to March


Quarter 2: April to June
Quarter 3: July to September
Quarter 4: October to December

Example:
Number of visits to a Museum.

Many quarterly data is driven seasons. For example,


museum visits are low in winter months and high in
summer months.
Time series data – Graphically

Note: The trend is downward (over the years) and the seasonality is regular every 4 seasons
Time series data – Trend
To predict the trend for this quarterly time series, we need to use the “Moving Average” with 4 point period.
Time series data – Predictions
The predictions are obtained using the Excel “Forecast Sheet” facility (See previous slide).
Time series data – Numerical predictions
The numerical predictions are
also obtained using the
“Forecast Sheet” option.

The historical data for museum


visits runs up to 2010 (Quarter 4).

Predictions for Year 2011.


Quarter 1: 5397 visits
Quarter 2: 6813 visits
Quarter 3: 8043 visits
Quarter 4: 5796 visits
Extra Reading - Indices
What is an Index ?
•Not just something that you use as an alphabetical reference for a book or use in a
databases.
•An index represents a single item or a set of related items. There are lots of
examples of data indices which are monitored and studied constantly.
•Some examples are commodity indices where items like coffee, barley, cocoa,
soybeans, zinc, and wheat are measured and stored. Quite often this data is
captured in financial markets for trading.
•For example see this article on coffee prices and adjusting for inflation. What is
inflation - we will discuss later
•One of the main sources of statistics data is the Office for National Statistics.
Extra Reading - Office for National Statistics
Office for National Statistics: found at www.ons.gov.uk
"The UK's largest independent producer of official statistics and the recognised national statistical
institute of the UK."
•The ONS is responsible for collecting data and producing information which is used extensively for
social and economic making by local regional and national governments of England and Wales.
•The ONS collects data to help governments and agencies understand what is going on in the economy
and plan.
•They collect all sorts of data from inflation, GDP, employment (and conversely unemployment) and
even things such as the popularity of baby names !!!
https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/livebirths/bulletins/babynames
englandandwales/2019

•Ensure you make time to learn what the ONS can offer you, and perhaps your employer (now or in the
future too)
Extra Reading - Inflation
Inflation is the measure of how much goods
and services rise and fall over time –
https://www.ons.gov.uk/economy/
inflationandpriceindices/timeseries/cdko/mm23
The government uses a notional basket of
good to represent everything that we spend
our money on. They collect over 700 prices
every month is places all around the country to
gauge how prices change for the goods that
represent our current way of life.
This basket is not static and changes over
time. It should reflect what individuals pay for
and includes travel and services such as
mobile, internet etc

Inflation and Exchange Rates


Student Task
 The figure below illustrates seasonality. The figure, used in many data analysis
articles, is of US airline passengers from the 1940's to the 1960's.
 We have uploaded the dataset under the name airline passengers
 Observe the data, what do you think has happened in flight demand in around 60
years?
 Use the Data to predict the future values as we did in the lecture
Recommended Reading
You have a rich list of resources to explore:
https://learn.solent.ac.uk/course/view.php?id=42897&section=2

ONS - What is the CENSUS?


How to Deflate Your Time Series
ONS - Understanding How to Present DATA
 For next week read all of the sections on presenting data from the Office of
National Statistics, ONS
Click https://style.ons.gov.uk/category/data-visualisation/ link to open resource.
Read about Inflation and Exchange Rates
Questions?

You might also like