VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
TIMES SERIES FORECASTING ON HISTORICAL DATA IN R
1. TIME SERIES FORECASTING
9-Jan-18 1
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
3. Why Forecast?
Every organization faces internal and external risks, such as
high competition, failure of technology, labor unrest, inflation,
recession, and change in government laws.
Every business operates under risk and uncertainty
Forecast is necessary to lessen the adverse effects of risks
There are varied methods of forecast – some of which you
have already covered. Such as
– Regression
– Data mining methods
3
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
4. Why Forecast?
Time Series is another technique for forecasting
Why do we need so many techniques for forecasting? Because
not all data are the same, or similar. Because different types of
data possess different features, different methods of forecast
becomes applicable
For example: In regression or CART you have one response
and a number of predictors
4
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
5. How to Forecast
• If it is a problem of whether to extend loan facility
to the next applicant, a bank matches profile of the
applicant with their historic data repository and
take a decision based on the likelihood of the
applicant’s loan ‘going bad’!
• The applicant’s demographical information,
economic stability as well as various other
predictors are used for taking the final decision
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
6. Monthly Sales of a Shoe Type
Based on the above how to predict sales for the next two years?
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
7. How to Forecast?
This is an example of Time Series Data
The objective of this lesson is to learn about
What is time series?
Where do we encounter time series data?
What are the special features of time series data?
What are the typical situations where time series methods
are applied?
7
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
8. What is Time Series?
A time series is a sequence of measurements on the same variable
collected over time.
The measurements are made at regular time intervals.
8
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
9. Monthly Sales of a Shoe Type
Monthly sales volume for
popular type of shoes by a
certain manufacturer
The variable observed is
Sales Volume
It is observed every month
– regular interval
It is observed for full 5
years : 2011 – 2015
This is an example of
monthly TS data
Year Month No. of Pairs
2011 Jan 742
2011 Feb 741
2011 Mar 896
2011 Apr 951
2011 May 1030
2011 Jun 697
… … …
2015 Jul 1119
2015 Aug 783
2015 Sep 901
2015 Oct 1023
2015 Nov 1209
2015 Dec 1013
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
10. Yearly GDP of USA
The variable observed is
GDP
It is observed every year
1929 - 1992
This is an example of
yearly TS data
10
What is Time Series?
Year US GDP
1929 821.8
1930 748.9
1931 691.3
1932 599.7
……… …………
1990 4739.2
1991 4822.3
1992 4835
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
11. What is Time Series?
Quarterly income of a
certain Company
The variable observed is
Revenue
It is observed every
quarter from Q4 2000 to
Q1 2014
This is an example of
quarterly TS data
11
Year Quarter
Income (m.
USD)
2000 Q4 3616
2001 Q1 3043
2001 Q2 2778
2001 Q3 2839
2001 Q4 3212
2002 Q1 3297
…… …….. ……..
2012 Q4 5624
2013 Q1 5505
2013 Q2 5122
2013 Q3 5633
2013 Q4 6793
2014 Q1 5130
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
12. What is Time Series?
We can think of daily time series –
• daily closing price or daily closing volume of a certain
stock
• Sensex value
• Total daily transaction volume of your nearest ATM
machine
All are examples of time series
12
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
13. What is not a Time Series?
Data collected on multiple items at the same point
of time is not a time series!
Example: DowJones average on a single day
13
Date MMM T AXP BA CAT CVX CSCO KO DD XOM
1/9/2012 0.0046 -0.0094 0.0037 0.0042 0.0332 -0.008 0.0183 -0.0173 -0.0017 -0.0058
GE GS HD INTC IBM JPM JNJ MCD MRK MSFT
1/9/2012 0.0272 -0.007 0.0259 0.0379 -0.0253 0.0164 -0.0144 0.0081 0.0023 0.0362
NKE PFE PG TRV UTX UNH VZ V WMT DIS
1/9/2012 0.0159 -0.0068 -0.0028 0.0119 -0.0075 0.0239 -0.0217 -0.03 -0.0191 0.0376
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
14. What is not a Time Series?
When time periods are not the same: For
example in a single time series both yearly and
quarterly data cannot be mixed
14
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
15. Where do we encounter TS Data?
As our examples show, almost everywhere we
can come across time series data
Financial reports deal with TS data on a daily basis. To take a
decision on the bank rates, they have to look at the past data
and project it for the future
All manufacturers of multiple items have to optimize their
production process
15
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
16. Where do we encounter TS Data?
Companies need to evaluate their manpower requirements
from historic data and take a decision regarding hiring
Portfolio managers try to understand stock movements based
on past data so that they can be more effective in advising
their clients how best to invest
Movement of the demand of electricity consumption pattern
provides policy makers impetus on where to build the new
electricity production plant and when
16
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
17. Where do we encounter TS Data?
Based on the demands of airline tickets between cities, airlines
create their dynamic ticket pricing
Based on past data on booking pattern hotels decide on
whether any discounts are to be offered in room pricing at
certain times of the year
In short, time series data is being collected and utilized in all
data driven decision mechanisms
17
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
18. What are the special features of TS
Data?
The most important feature that make TS analysis challenging
and none of the other machine learning techniques are
applicable is because
Data are not independent
One defining characteristic of time series is that this is a list of observations
where the ordering matters.
Ordering is very important because there is dependency and changing the order
will change the meaning of the data.
18
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
19. If data is cross-sectional
19
Make Year of Make MPG Horsepower Weight
AMC 80 24.3 90 3003
Audi 80 34.3 78 2188
Buick 81 22.4 110 3415
Chevy 82 27 90 2950
Chrysler 82 26 92 2585
Datsun 81 32.9 100 2615
Make Year of Make MPG Horsepower Weight
Datsun 81 32.9 100 2615
Audi 80 34.3 78 2188
Chevy 82 27 90 2950
Chrysler 82 26 92 2585
AMC 80 24.3 90 3003
Buick 81 22.4 110 3415
Order of the
Observations
Does not
matter
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
20. If data is time series
20
Order of the
Observations is
All Important
Year Month No. of Pairs
2011 Jan 742
2011 Feb 741
2011 Mar 896
2011 Apr 951
2011 May 1030
2011 Jun 697
Year Month
No. of
Pairs
2011 Mar 896
2011 Jan 742
2011 May 1030
2011 Feb 741
2011 Apr 951
2011 Jun 697
WRONG
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
21. Objective of this Module
To learn to forecast!
Not all series is equally easy or difficult to forecast. It depends on
How well the contributing factors are understood
How much data is available
We should not try to forecast if the historical data available is for a
short duration
21
2015 Jul 1119
2015 Aug 783
2015 Sep 901
2015 Oct 1023
2015 Nov 1209
2015 Dec 1013
Will not provide reliable forecast for
Next 6 months
Might get a working forecast for the
Next 1 or 2 months
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
22. Degrees of Difficulty
Easy to Forecast:
• GDP of a country
• Passenger volume for an established airlines
Because there are plethora of data available and the system is stable
Not so Easy! Currency Exchange Rate
• Limited understanding of market force
• Self-correcting market – forecast values affect the exchange rate
movement
Notoriously difficult to predict
22
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
23. Forecast Range
Very long range forecasts do not work well!!
• Forecasts are done under the assumption that the market and other
conditions in future are very much like the present
• Not that there will be no change in the market
• But the change is gradual, not a drastic change
• A financial crash like 2008 US market will send all forecasts into a tizzy
• Events like Demonetization would throw the forecasts into disarray
Based on the amount of data availability, one should not try to forecast
more than a few periods ahead
23
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
24. Scope of Module
• Only univariate TS is explored
• No attempt made to forecast more than one
interdependent TS
• The variable measured in TS is assumed to be
continuous and have fairly decent volume
• Intermittent demand TS is not considered
24
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.
25. Next Step
In the next lesson we explore time series more
closely and understand different components
through visual methods
Thank You
haritika74@gmail.com
BABIINTLMAY19001
This file is meant for personal use by haritika74@gmail.com only.
Sharing or publishing the contents in part or full is liable for legal action.