Time Series and Forecasting

Similar documents
Time Series and Forecasting

Based on the original slides from Levine, et. all, First Edition, Prentice Hall, Inc

Time Series Analysis -- An Introduction -- AMS 586

Multiple Regression Analysis

The Art of Forecasting

14. Time- Series data visualization. Prof. Tulasi Prasad Sariki SCSE, VIT, Chennai

Lecture 4 Forecasting

Time Series Analysis

Introduction to Forecasting

at least 50 and preferably 100 observations should be available to build a proper model

TIME SERIES ANALYSIS AND FORECASTING USING THE STATISTICAL MODEL ARIMA

Forecasting. Simon Shaw 2005/06 Semester II

Analysis. Components of a Time Series

Forecasting. Operations Analysis and Improvement Spring

Classic Time Series Analysis

Suan Sunandha Rajabhat University

Decision 411: Class 9. HW#3 issues

Forecasting. BUS 735: Business Decision Making and Research. exercises. Assess what we have learned

3 Time Series Regression

Decision 411: Class 3

BUSI 460 Suggested Answers to Selected Review and Discussion Questions Lesson 7

Time Series Analysis of Stock Prices Using the Box- Jenkins Approach

Decision 411: Class 3

Time Series Analysis of United States of America Crude Oil and Petroleum Products Importations from Saudi Arabia

Time Series Outlier Detection

Time Series Analysis of Currency in Circulation in Nigeria

Industrial Engineering Prof. Inderdeep Singh Department of Mechanical & Industrial Engineering Indian Institute of Technology, Roorkee

EXAMINATIONS OF THE ROYAL STATISTICAL SOCIETY

Basics: Definitions and Notation. Stationarity. A More Formal Definition

Chapter 12: An introduction to Time Series Analysis. Chapter 12: An introduction to Time Series Analysis

Introduction to Regression Analysis. Dr. Devlina Chatterjee 11 th August, 2017

Decision 411: Class 3

Chapter 5: Forecasting

Cyclical Effect, and Measuring Irregular Effect

Time-Series Analysis. Dr. Seetha Bandara Dept. of Economics MA_ECON

FinQuiz Notes

Lecture Prepared By: Mohammad Kamrul Arefin Lecturer, School of Business, North South University

Empirical Market Microstructure Analysis (EMMA)

INDIAN INSTITUTE OF SCIENCE STOCHASTIC HYDROLOGY. Lecture -12 Course Instructor : Prof. P. P. MUJUMDAR Department of Civil Engg., IISc.

Minitab Project Report - Assignment 6

Chapter 8 - Forecasting

Forecasting the Canadian Dollar Exchange Rate Wissam Saleh & Pablo Navarro

STAT 115: Introductory Methods for Time Series Analysis and Forecasting. Concepts and Techniques

A time series is called strictly stationary if the joint distribution of every collection (Y t

Operations Management

ESSE Mid-Term Test 2017 Tuesday 17 October :30-09:45

Some Time-Series Models

Available online at ScienceDirect. Procedia Computer Science 72 (2015 )

Euro-indicators Working Group

TILT, DAYLIGHT AND SEASONS WORKSHEET

Electric Load Forecasting Using Wavelet Transform and Extreme Learning Machine

YEAR 10 GENERAL MATHEMATICS 2017 STRAND: BIVARIATE DATA PART II CHAPTER 12 RESIDUAL ANALYSIS, LINEARITY AND TIME SERIES

Lecture 2: Univariate Time Series

Comparing the Univariate Modeling Techniques, Box-Jenkins and Artificial Neural Network (ANN) for Measuring of Climate Index

A SEASONAL TIME SERIES MODEL FOR NIGERIAN MONTHLY AIR TRAFFIC DATA

MODELING INFLATION RATES IN NIGERIA: BOX-JENKINS APPROACH. I. U. Moffat and A. E. David Department of Mathematics & Statistics, University of Uyo, Uyo

Operations Management

1. Fundamental concepts

Technical note on seasonal adjustment for Capital goods imports

CP:

WEATHER NORMALIZATION METHODS AND ISSUES. Stuart McMenamin Mark Quan David Simons

Statistical Methods for Forecasting

STOCHASTIC MODELING OF MONTHLY RAINFALL AT KOTA REGION

Forecasting. Dr. Richard Jerz rjerz.com

The log transformation produces a time series whose variance can be treated as constant over time.

Time series and Forecasting

Time Series I Time Domain Methods

CHAPTER 4: DATASETS AND CRITERIA FOR ALGORITHM EVALUATION

Forecasting. Copyright 2015 Pearson Education, Inc.

Chapter 8: Model Diagnostics

Copyright 2010 Pearson Education, Inc. Publishing as Prentice Hall.

Part II. Time Series

Chapter 13: Forecasting

Analysis of Violent Crime in Los Angeles County

Lecture Prepared By: Mohammad Kamrul Arefin Lecturer, School of Business, North South University

Stat 565. Spurious Regression. Charlotte Wickham. stat565.cwick.co.nz. Feb

Technical note on seasonal adjustment for M0

Week 9: An Introduction to Time Series

Econ 300/QAC 201: Quantitative Methods in Economics/Applied Data Analysis. 17th Class 7/1/10

Lecture 19 Box-Jenkins Seasonal Models

Multiple Regression Analysis

Read Section 1.1, Examples of time series, on pages 1-8. These example introduce the book; you are not tested on them.

Assistant Prof. Abed Schokry. Operations and Productions Management. First Semester

Time Series Analysis Model for Rainfall Data in Jordan: Case Study for Using Time Series Analysis

FORECASTING FLUCTUATIONS OF ASPHALT CEMENT PRICE INDEX IN GEORGIA

Lesson 13: Box-Jenkins Modeling Strategy for building ARMA models

7CORE SAMPLE. Time series. Birth rates in Australia by year,

Multivariate Regression Model Results

Chapter 1. Introduction. Sales Forecasting of Grameenphone Business Solutions SIM BUS 650 1

Modeling and forecasting global mean temperature time series

QMT 3001 BUSINESS FORECASTING. Exploring Data Patterns & An Introduction to Forecasting Techniques. Aysun KAPUCUGİL-İKİZ, PhD.

Estimation and application of best ARIMA model for forecasting the uranium price.

Forecasting using R. Rob J Hyndman. 1.3 Seasonality and trends. Forecasting using R 1

Stochastic Processes

Abram Gross Yafeng Peng Jedidiah Shirey

Forecasting using R. Rob J Hyndman. 2.4 Non-seasonal ARIMA models. Forecasting using R 1

Elements of Multivariate Time Series Analysis

Chapter 7 Forecasting Demand

DEPARTMENT OF QUANTITATIVE METHODS & INFORMATION SYSTEMS

INTRODUCTION TO TIME SERIES ANALYSIS. The Simple Moving Average Model

Transcription:

Time Series and Forecasting Introduction to Forecasting n What is forecasting? n Primary Function is to Predict the Future using (time series related or other) data we have in hand n Why are we interested? n Affects the decisions we make today n Where is forecasting used? n forecast demand for products and services n forecast availability/need for manpower n forecast inventory and materiel needs daily 1

What is forecasting all about? Demand for Vespa We try to predict the future by looking back at the past Jan Feb Mar Apr May Jun Jul Aug Actual demand (past sales) Predicted demand Time Predicted demand looking back six months Characteristics of Forecasts n They are usually wrong! n A good forecast is more than a single number n Includes a mean value and standard deviation n Includes accuracy range (high and low) n Aggregated forecasts are usually more accurate n Accuracy erodes as we go further into the future. n Forecasts should not be used to the exclusion of known information 2

Time Series Methods n A time series is just collection of past values of the variable being predicted. Also known as naïve methods. Goal is to isolate patterns in past data. (See Figures on following pages) n Trend n Seasonality n Cycles n Randomness 3

Trend Component n n Overall Upward or Downward Movement Data Taken Over a Period of Years Sales Upward trend Time 4

Cyclical Component n Repeating up & down movements n Due to interactions of factors influencing economy n Usually 2-10 years duration Response Cycle Mo., Qtr., Yr. Cyclical Component n n n Upward or Downward Swings May Vary in Length Usually Lasts 2-10 Years Sales Cycle Time 5

Cyclostationary process n Signal having statistical properties that vary cyclically with time n For example, the maximum daily temperature in New York City can be modeled as a cyclostationary process n the maximum temperature on July 21 is statistically different from the temperature on December 20; however, n it is a reasonable approximation that the temperature on December 20 of different years has identical statistics. Seasonal Component n Regular pattern of up & down fluctuations n Due to weather, customs etc. n Occurs within one year Response Summer Mo., Qtr. 6

Seasonal Component n n n Upward or Downward Swings Regular Patterns Observed Within One Year Sales Winter Time (Monthly or Quarterly) Irregular Component n Erratic, unsystematic, residual fluctuations n Due to random variation or unforeseen events n Union strike n War n Short duration & nonrepeating 7

What should we consider when looking at past demand data? Trends Seasonality Cyclical elements Autocorrelation Random variation Stationary stochastic process n Stochastic process whose joint probability distribution does not change when shifted in time n Mean and variance do not change over time and do not follow any trends 8

White Noise is stationary n In signal processing, white noise is a random signal with a constant power spectral density Linear Systems n It s possible that P, the process whose output we are trying to predict, is governed by linear dynamics. n Example: stationary stochastic process 9

Causal Models n Let Y be the quantity to be forecasted n (X 1, X 2,..., X n ) are n variables that have predictive power for Y. n A causal model is Y = f (X 1, X 2,..., X n ). n A typical relationship is a linear one: Y = a 0 + a 1 X 1 +... + a n X n Moving Average Year Sales MA(3) in 1,000 1995 20,000 NA 1996 24,000 (20+24+22)/3 = 22 1997 22,000 (24+22+26)/3 = 24 1998 26,000 (22+26+25)/3 = 24 1999 25,000 NA 10

Moving Average Year Response Moving Ave Sales 1994 2 NA 8 1995 5 3 6 1996 2 3 4 1997 2 3.67 2 1998 7 5 0 1999 6 NA 94 95 96 97 98 99 In the simple moving average models the forecast value is F t+1 = A t + A t-1 + + A t-n n t is the current period. F t+1 is the forecast for next period n is the forecasting horizon (how far back we look), A is the actual sales figure from each period. 11

Example: Kroger sells (among other stuff) bottled spring water Month Bottles Jan 1,325 Feb 1,353 Mar 1,305 Apr 1,275 May 1,210 Jun 1,195 Jul? What will the sales be for July? What if we use a 3-month simple moving average? F Jul = A Jun + A May + A Apr 3 = 1,227 What if we use a 5-month simple moving average? F Jul = A Jun + A May + A Apr + A Mar + A Feb 5 = 1,268 12

1400 1350 1300 1250 1200 1150 1100 1050 1000 0 1 2 3 4 5 6 7 8 5-month MA forecast 3-month MA forecast What do we observe? 5-month average smoothes data more; 3-month average more responsive Stability versus responsiveness in moving averages Demand 1000 900 800 700 600 500 1 2 3 4 5 6 7 8 9 10 11 12 Week Demand 3-Week 6-Week 13

Time series: weighted moving average We may want to give more importance to some of the data F t+1 = w t A t + w t-1 A t-1 + + w t-n A t-n w t + w t-1 + + w t-n = 1 t is the current period. F t+1 is the forecast for next period n is the forecasting horizon (how far back we look), A is the actual sales figure from each period. w is the importance (weight) we give to each period Why do we need the WMA models? Because of the ability to give more importance to what happened recently, without losing the impact of the past. Demand for Vespa Actual demand (past sales) Prediction when using 6-month SMA Prediction when using 6-months WMA Jan Feb Mar Apr May Jun Jul Aug Time For a 6-month SMA, attributing equal weights to all past data we miss the downward trend 14

Example: Kroger sales of bottled water Month Bottles Jan 1,325 Feb 1,353 Mar 1,305 Apr 1,275 May 1,210 Jun 1,195 Jul? What will be the sales for July? 6-month simple moving average F Jul = A Jun + A May + A Apr + A Mar + A Feb + A Jan 6 = 1,277 In other words, because we used equal weights, a slight downward trend that actually exists is not observed 15

What if we use a weighted moving average? Make the weights for the last three months more than the first three months 6-month SMA WMA 40% / 60% WMA 30% / 70% WMA 20% / 80% July Forecast 1,277 1,267 1,257 1,247 The higher the importance we give to recent data, the more we pick up the declining trend in our forecast. How do we choose weights? 1. Depending on the importance that we feel past data has 2. Depending on known seasonality (weights of past data can also be zero). WMA is better than SMA because of the ability to vary the weights! 16

Time Series: Exponential Smoothing (ES) Main idea: The prediction of the future depends mostly on the most recent observation, and on the error for the latest forecast. Smoothing constant alpha α Denotes the importance of the past error Why use exponential smoothing? 1. Uses less storage space for data 2. Extremely accurate 3. Easy to understand 4. Little calculation complexity 5. There are simple accuracy tests 17

Exponential smoothing: the method Assume that we are currently in period t. We calculated the forecast for the last period (F t-1 ) and we know the actual demand last period (A t-1 ) F t = Ft 1 t 1 t + α( A F ) 1 The smoothing constant α expresses how much our forecast will react to observed differences If α is low: there is little reaction to differences. If α is high: there is a lot of reaction to differences. Example: bottled water at Kroger Month Actual Forecasted α = 0.2 Jan 1,325 1,370 Feb 1,353 1,361 Mar 1,305 1,359 Apr 1,275 1,349 May 1,210 1,334 Jun? 1,309 18

Example: bottled water at Kroger Month Actual Forecasted α = 0.8 Jan 1,325 1,370 Feb 1,353 1,334 Mar 1,305 1,349 Apr 1,275 1,314 May 1,210 1,283 Jun? 1,225 Impact of the smoothing constant 1380 1360 1340 1320 1300 1280 1260 1240 1220 1200 0 1 2 3 4 5 6 7 Actual a = 0.2 a = 0.8 19

Linear regression in forecasting Linear regression is based on 1. Fitting a straight line to data 2. Explaining the change in one variable through changes in other variables. dependent variable = a + b (independent variable) By using linear regression, we are trying to explore which independent variables affect the dependent variable Example: do people drink more when it s cold? Alcohol Sales Which line best fits the data? Average Monthly Temperature 20

Autoregressive model n AR(p) refers to the autoregressive model of order p n Parameters n c is a constant, and white noise Moving-average model n MA(q) refers to the moving average model of order q 21

ARMA n After choosing p and q the ARMA models can be fitted by least squares regression to find the values of the parameters which minimize the error term n Good practice: find the smallest values of p and q which provide an acceptable fit to the data Lag model n Lag model is a model for time series data in which a regression equation is used to predict current values of a dependent variable n It is based on both the current values of an explanatory variable and the lagged (past period) values of this explanatory variable 22

Autoregressive Integrated Moving Average (ARIMA) n Generalization of ARMA Are an adaptation of discrete-time filtering methods developed in 1930 s-1940 s by electrical engineers (Norbert Wiener et al.) n A series which needs to be differenced to be made stationary is an integrated (I) series (new) n Lags of the stationarized series are called autoregressive (AR) terms n Lags of the forecast errors are called moving average (MA) terms ARIMA terminology n A non-seasonal ARIMA model can be (almost) completely summarized by three numbers: n p = the number of autoregressive terms n d = the number of nonseasonal differences n q = the number of moving-average terms åthis is called an ARIMA(p,d,q) model The model may also include a constant term (or not) 23

ARIMA forecasting equation n Let Y denote the original series n Let y denote the differenced (stationarized) series n No difference (d=0): y t = Y t n First difference (d=1): y t = Y t -Y t-1 n Second difference (d=2): y t = (Y t - Y t-1 ) - (Y t-1 - Y t-2 ) = Y t - 2Y t-1 + Y t-2 24

Undifferencing the forecast n The differencing (if any) must be reversed to obtain a forecast for the original series: n If (d=0): Y t = Y t n If (d=1): Y t =y t +Y t-1 n If (d=2): Y t =y t + 2Y t-1 - Y t-2 Microsoft Time Series n The ARTXP algorithm is optimized for predicting the next likely value in a series n short-term prediction n The ARIMA algorithm improves accuracy for long-term prediction n long-term prediction 25

n ARTXP algorithm is based on Autoregressive Tree Models n Generalization of standard-autoregressive models AR(p) n The decision tree has linear regressions at its leaves n Standard windowing transformations of time-series are used to generate subtime-series n Sub-series are used for for predicting values by regression analysis AR(p) n Each sub-series corresponds to AR(p) 26

n The decision tree has linear regressions at its leaves n Decision tree with one single leaf is equal to AR(p) model n Several leaves can model non-linear relationships in time series data (combination of several AR(p) models) n Temporal sequence Y=(Y 1,Y 2,.., Y T ) n Each sub-series corresponds to AR i (p) n Binary search in the tree for the probable AR i (p) 27

Causal Models and Neural Networks n Let Y be the quantity to be forecasted n (X 1, X 2,..., X n ) are n variables that have predictive power for Y. n A causal model is Y = f (X 1, X 2,..., X n ). n Non Linear Model f (X 1, X 2,..., X n ) represened by NN 28

Neural Networks for Time Series Prediction n Based on earlier slides by Dave Touretzky and Kornel Laskowski What is a Time Series for NN? n sequence of vectors (or scalars) which depend on time t. In this lecture we will deal exclusively with scalars: n { x(t 0 ), x(t 1 ), x(t i 1 ), x(t i ), x( ti+1 ), } It s the output of some process P that we are interested in: 29

Possible Types of Processing n Predict future values of x[t] n Classify a series into one of a few classes n price will go up price will go down sell now no change n Describe a series using a few parameter values of some model n Transform one time series into another n oil prices interest rates Using the Past to Predict the Future 30

The Problem of Predicting the Future n Extending backward from time t, we have time series {x[t], x[t 1], }. From this, we now want to estimate x at some future time n x[t+s] = f( x[t], x[t 1], ) n s is called the horizon of prediction. Horizon of Prediction n So far covered many neural net architectures which could be used for predicting the next sample in a time series. What if we need a longer forecast, ie. not x[t + 1] but x[t + s], with the horizon of prediction s > 1? 31

n Train on {x[t],x[t 1],x[t 2], } to predict x[t + s] n Train to predict all x[t+i], 1 i s (good for small s). n Train to predict x[t + 1] only, but iterate to get x[t + s] for any s. Predicting Sunspot Activity n Sunspots affect ionospheric propagation of radio waves. n Telecom companies want to predict sunspot activity six months in advance. n Sunspots follow an 11 year cycle, varying from 9-14 years. Monthly data goes back to 1849. 32

Predicting Sunspot Activity n Fessant, Bengio and Collobert. n Authors focus on predicting IR5, a smoothed index of monthly solar activity. 33

Simple Feedforward NN Modular Feedforward NN 34

Elman NN 35