Applied Forecasting ST3010 Michaelmas term 2015 Prof. Rozenn Dahyot Room 128 Lloyd Institute School...
-
Upload
jane-charlene-carpenter -
Category
Documents
-
view
214 -
download
0
Transcript of Applied Forecasting ST3010 Michaelmas term 2015 Prof. Rozenn Dahyot Room 128 Lloyd Institute School...
Applied Forecasting ST3010Michaelmas term 2015
Prof. Rozenn Dahyot
Room 128 Lloyd Institute
School of Computer Science and Statistics
Trinity College Dublin
[email protected] or [email protected]
+353 1 896 1760
Lecture notes available online
@ https://www.scss.tcd.ie/Rozenn.Dahyot/In the โteachingโ section.
Possibly some materials will be on blackboard
Timetable
โขMondayโข 9am-10am in LB01โข 4pm-5pm in LB1.07
โขFridayโข 10am-11am in Salmon 1 (Hamilton Building)
Organization of the course
โขLectures-tutorials only:โข No labs but information using R for Forecasting will be
provided.
โขExam 100%โข No assignments
Software R http://www.r-project.org/
Content
Content
โข Introduction to forecasting; ARIMA models, GARCH models, Kalman Filters,data transformations, seasonality, exponential smoothing and Holt Winters algorithms, performance measures. Use of transformations and differences.
Textbook
โข Forecasting: Methods and Applications by Makridakis, Wheelwright and Hyndman, published by Wiley
โข Many more books in the libraries in Trinity on Forecasting , time series covering the content of this course.
Who Forecast?
Why Forecast?
How to Forecast?
In this course we will use maths/stats techniques for forecasting
Steps in a Forecasting Procedure?
Problem definition
Exploratory Analysis
Gathering information
Selecting and fitting models to make forecast
Using and evaluating the forecast
Examples
โข https://www.google.ie/trends/
โข http://static.googleusercontent.com/media/research.google.com/en//archive/papers/detecting-influenza-epidemics.pdf
Examplesโฆ. Warnings
Epidemiological modeling of online social network dynamicshttp://arxiv.org/abs/1401.4208
http://languagelog.ldc.upenn.edu/nll/?p=9977
Quantitative Forecasting
Quantitative methods
Time series models Vs Explanatory models
Time series
What is the nature of the data to analyse?โข Examples from fma packages in R
โข airpassโข beerโข internetโข cowtempโข Dowjonesโข mink
โข Can you predict how these time series look like ?
Visualization tools
โข Numerical values
โข Time plot
โข Season plot
Patterns to identify
โข Trendsโข Seasonalโข Error/noise
โข Visualize and identify patterns:โข airpassโข beerโข internetโข cowtempโข Dowjonesโข mink
Time series
โข Definition
โข Sampling rate & Unit of time
โข Preparation of Data before analysis
Limitations in this module
โข 1D time series
โข No outliers
โข No missing data
Notations
โข Variables Vs numerical values
โข Time series
Auto-Correlation Function (ACF)Mean value of the time series
Autocorrelation at lag k
Auto Correlation Function (ACF)
Lag k
r1
r2
r3
1 2 3
Time
be
er
- m
ea
n(b
ee
r)
1991 1992 1993 1994 1995
-20
02
04
0
> plot(beer-mean(beer),lwd="3")> lines(lag(beer-mean(beer),1),col="red",lwd=3)
In red, The lag series beer (lag 1 ).The two time series overlap well.
0 10 20 30 40 50
-0.4
-0.2
0.0
0.2
0.4
0.6
0.8
1.0
Lag
AC
F
Series ts(beer, freq = 1)
Time
be
er
- m
ea
n(b
ee
r)
1991 1992 1993 1994 1995
-20
02
04
0
In red, The lag series beer (lag 6 ).The two time series do not overlap well.
> plot(beer-mean(beer),lwd="3")> lines(lag(beer-mean(beer),6),col="red",lwd=3)
0 10 20 30 40 50
-0.4
-0.2
0.0
0.2
0.4
0.6
0.8
1.0
Lag
AC
F
Series ts(beer, freq = 1)
Time
be
er
- m
ea
n(b
ee
r)
1991 1992 1993 1994 1995
-20
02
04
0
In red, The lag series beer (lag 12 ).The two time series do overlap well.
> plot(beer-mean(beer),lwd="3")> lines(lag(beer-mean(beer),12),col="red",lwd=3)
0 10 20 30 40 50
-0.4
-0.2
0.0
0.2
0.4
0.6
0.8
1.0
Lag
AC
F
Series ts(beer, freq = 1)
Time
air
pa
ss -
me
an
(air
pa
ss)
1950 1952 1954 1956 1958 1960
-10
00
10
02
00
30
0
For the airpass time series
0 10 20 30 40 50
-0.2
0.0
0.2
0.4
0.6
0.8
1.0
Lag
AC
F
Series ts(airpass, freq = 1)
Time
air
pa
ss -
me
an
(air
pa
ss)
1950 1952 1954 1956 1958 1960
-10
00
10
02
00
30
0
Time
air
pa
ss -
me
an
(air
pa
ss)
1950 1952 1954 1956 1958 1960
-10
00
10
02
00
30
0
Lag 1Lag 6
Lag 12
Partial AutoCorrelation Function (PACF)
Holt-Winters Algorithms
Part I
Algo I: Simple Exponential Smoothing (SES)
โข What does SES do?
โข What happens when a=1 or a=0 ?
โข SES is an algorithm suitable for a time series with โฆ
Algo I: Simple Exponential Smoothing (SES)
Algo II: Double Exponential Smoothing (DES)
SES(a)
DES( ,a b)
DES( ,a b)
SHW+( , ,a b g)
SHW+( , ,a b g) SHWx( , ,a b g)
Linear Regression
Useful formulas
Auto-Regressive Models โ AR(1)
๐ฆ ๐ก=๐0+๐1 ๐ฆ๐ก โ1+๐๐ก
Explanatory variable
Parameters to estimate
Auto-Regressive Models โ AR(2)
๐ฆ ๐ก=๐0+๐1 ๐ฆ๐ก โ1+๐2 ๐ฆ๐ก โ2+๐๐ก
Explanatory variables
Parameters to estimate
Auto-Regressive Models โ AR(p)
๐ฆ ๐ก=๐0+๐1 ๐ฆ๐ก โ1+๐2 ๐ฆ๐ก โ2+โฆ+๐๐ ๐ฆ ๐กโ๐+๐๐ก
Parameters to estimate
Explanatory variables
AR(1): Least Squares estimates of the parameters
๏ฟฝฬ๏ฟฝ=(๐ ยฟยฟ๐ ๐ )โ1๐ ๐ ๏ฟฝโ๏ฟฝ ยฟ
, , 6, ,
๐ฆ ๐ก=๐0+๐1 ๐ฆ๐ก โ1+๐๐กmodel
Write the least squares solution.
AR(1): Least Squares estimates of the parameters
, , 6, ,
๐ฆ ๐ก=๐0+๐1 ๐ฆ๐ก โ1+๐๐กmodel
AR(1): Least Squares estimates of the parameters
๏ฟฝฬ๏ฟฝ=(๐ ยฟยฟ๐ ๐ )โ1๐ ๐ ๏ฟฝโ๏ฟฝ ยฟ
๐ฆ๐=[1141316
17]๐=[๐0
๐1]
Estimate of s
Estimate the standard deviation of the noise
Example: dowjones
Auto-Regressive Models โ AR(p)
๐ฆ ๐ก=๐0+๐1 ๐ฆ๐ก โ1+๐2 ๐ฆ๐ก โ2+โฆ+๐๐ ๐ฆ ๐กโ๐+๐๐ก
Parameters to estimate
Explanatory variables
Moving Average MA(1)
๐ฆ ๐ก=๐0+๐1๐๐ก โ1+๐๐ก
Explanatory variable
Parameters to estimate
Can Least Squares Algorithm be used to estimate the parameters?
Moving average MA(q)
๐ฆ ๐ก=๐0+๐1๐๐ก โ1+๐2๐๐กโ 2+โฆ+๐๐๐๐กโ๐+๐๐ก
Parameters to estimate
Explanatory variables
Exercises
Remark
Expectation
Summary 17/11/2014
โข Using ACF and PACF to identify AR(p) and MA(q)
โข Procedure to fit an ARIMA(p,d,q)
โข Definition of BIC/AIC
Fitting ARIMA(p,d,q)
Fitting ARIMA(p,d,q)
To avoid overfitting choose p โค 3 q โค 3 d โค 3
PACF for AR(1)
Maths
ACF for MA(1)
Maths
MA(1) as an AR(โ)
For MA(1) the Damped sine wave/exponential decay in the PACF corresponds to these coefficients vanishing towards 0
AR(1) as an MA(โ)
Criteria to select the best ARIMA model
Exercise: Show
Hirotugu Aikaike (1927-2009)
1970s: proposed model selection with an information Criterion (AIC)
Bayesian information Criterion
Thomas Bayes (1701-1761)
The BIC was developed by Gideon E. Schwarz, who gave a Bayesian argument for adopting it.
http://en.wikipedia.org/wiki/Bayesian_information_criterion
Seasonal ARIMA(p,d,q)(P,D,Q)s
Seasonal ARIMA(p,d,q)(P,D,Q)s
Choose your criterion AIC or BIC (and stick to it).Select the ARIMA model with the lowest AIC or BIC
with m=p+q+P+Q
ARIMA(0,0,0)(P=1,0,0)s Vs ARIMA(0,0,0)(0,D=1,0)s
๐ฆ ๐ก=๐+๐1 ๐ฆ๐กโ ๐ +๐๐ก
๐ฆ ๐ก=๐+๐ฆ๐ก โ๐ +๐๐ก
Summary
Summary
Summary
20141960s1950s 1970s 1980s 1990s
SESDESSHW+SHWx
ARIMA AIC BICHolt Winters
Other time series models
ARCH (1982): autoregressive conditional heteroskedasticity GARCH (1986): generalized autoregressive conditional heteroskedasticityโฆMore at http://en.wikipedia.org/wiki/Autoregressive_conditional_heteroskedasticity
Concluding Remarks
time
Concluding remarks
โข The Prediction โ Update loop
โข Combining experts