Upload
others
View
5
Download
0
Embed Size (px)
Citation preview
1 © 2014 The MathWorks, Inc.
Time Series Modeling with MATLAB
Abhishek Gupta
Application Engineer
2
Overview of Time Series Modeling
Time Series Modeling with MATLAB
Parametric Modeling - Regression
ARIMA/GARCH Modeling
Summary
Agenda
3
What is Time Series Modeling?
Use of mathematical language to make predictions
about the future
Time Series
Model
Input/
Predictors
Output/
Response
Electricity Demand
,...),,( DPtTfEL
Examples
Pairs Trading strategies
500 1000 1500 2000 2500 3000 3500 4000 450095
100
105
110
115
120
Price (
US
D)
Pairs trading results, Sharpe Ratio = 17.2
500 1000 1500 2000 2500 3000 3500 4000 4500-20
-10
0
10
20
Indic
ato
r
Pairs indicator: rebalance every 40 minutes with previous 180 minutes' prices.
500 1000 1500 2000 2500 3000 3500 4000 4500-5
0
5
10
Serial time number
Retu
rn (
US
D)
Final Return = 8.6 (7.89%)
LCO
WTI
Indicator
LCO: Over bought
LCO: Over sold
Position for LCO
Position for WTI
Cumulative Return
Q1-08 Q2-08 Q3-08 Q4-08 Q1-09 Q2-09 Q3-09 Q4-09 Q1-10 Q2-10 Q3-10 Q4-10 Q1-11 Q2-1120
40
60
80
100
120
140
160
Date
Price (
US
D)
Intraday prices for LCO and WTI
LCO
WTI
4
Overview of Time Series Modeling
Time Series Modeling with MATLAB
Parametric Modeling - Regression
ARIMA/GARCH Modeling
Summary
Agenda
5
Examples
Predicting S&P 500 (parametric)
– Multiple linear regression
– Feature selection and scenario analysis
Predicting S&P 500 (time series modeling)
– ARIMA modeling
– GARCH modeling
May-01 Feb-04 Nov-06 Aug-09 May-12
800
900
1000
1100
1200
1300
1400
1500
1600
1700
1800
S&
P 5
00
Realized vs Median Forecasted Path
Original Data
Simulated Data
-5
0
5
10
0
2
4
6
8-1.5
-1
-0.5
0
0.5
1
% Change in Crude Oil Returns
Scenario Analysis
Unemployment Rate (%)
% C
hange in S
&P
500 R
etu
rns
6
Financial Modeling Workflow
Research and Quantify
Data Analysis
& Visualization
Financial
Modeling
Application
Development
Reporting
Applications
Production
Share
Automate
Files
Databases
Datafeeds
Access
7
Example – Predicting S&P 500 Responses to
Economic Data
Goal:
– Predict changes to S&P 500
index as responses to changes
in economic data
Approach:
– Collect and “clean up” economic
and financial market data
– Model S&P 500 index returns
using multiple linear regression,
predictor selection and model
diagnostic techniques
2001 2007 2013600
800
1000
1200
1400
1600
1800
2000
S&P 500 Stock Price Index
(Index, Daily)
Response
2001 2007 20130
1000
2000
-5
0
5Equity Market-related Economic Uncertainty Index
(Index, Daily )
Leading Index f or the United States
(Percent, Monthly )
2001 2007 201302468
10
0246810
10-Year Treasury Constant Maturity Rate
(Percent, Daily )
3-Month Treasury Bill: Secondary Market Rate
(Percent, Monthly )
2001 2007 201302468
10
0246810
3-Month Eurodollar Deposit Rate (London)
(Percent, Daily )
3-Month London Interbank Of f ered Rate (LIBOR), based on U.S. Dollar
(Percent, Daily )
2001 2007 20130
1
2
50
100
150U.S. / Euro Foreign Exchange Rate
(U.S. Dollars to One Euro, Daily )
Japan / U.S. Foreign Exchange Rate
(Japanese Yen to One U.S. Dollar, Daily )
2001 2007 201302468
10
0246810x 10
5
Civ ilian Unemploy ment Rate
(Percent, Monthly )
Initial Claims
(Number, Weekly , Ending Saturday )
Predictors
-5
0
5
10
0
2
4
6
8-1.5
-1
-0.5
0
0.5
1
% Change in Crude Oil Returns
Scenario Analysis
Unemployment Rate (%)
% C
hange in S
&P
500 R
etu
rns
8
Regression Modeling Techniques
Regression
Non-linear Reg.
(GLM, Logistic)
Linear
Regression Decision Trees
Ensemble
Methods
Neural
Networks
9
Example – Predicting S&P 500 Responses to
Economic Data
Support for major data
providers
Numerous regression and
linear modeling techniques
with rich documentation
Interactive visualizations
Rapid exploration &
development
2001 2007 2013600
800
1000
1200
1400
1600
1800
2000
S&P 500 Stock Price Index
(Index, Daily)
Response
2001 2007 20130
1000
2000
-5
0
5Equity Market-related Economic Uncertainty Index
(Index, Daily )
Leading Index f or the United States
(Percent, Monthly )
2001 2007 201302468
10
0246810
10-Year Treasury Constant Maturity Rate
(Percent, Daily )
3-Month Treasury Bill: Secondary Market Rate
(Percent, Monthly )
2001 2007 201302468
10
0246810
3-Month Eurodollar Deposit Rate (London)
(Percent, Daily )
3-Month London Interbank Of f ered Rate (LIBOR), based on U.S. Dollar
(Percent, Daily )
2001 2007 20130
1
2
50
100
150U.S. / Euro Foreign Exchange Rate
(U.S. Dollars to One Euro, Daily )
Japan / U.S. Foreign Exchange Rate
(Japanese Yen to One U.S. Dollar, Daily )
2001 2007 201302468
10
0246810x 10
5
Civ ilian Unemploy ment Rate
(Percent, Monthly )
Initial Claims
(Number, Weekly , Ending Saturday )
Predictors
-5
0
5
10
0
2
4
6
8-1.5
-1
-0.5
0
0.5
1
% Change in Crude Oil Returns
Scenario Analysis
Unemployment Rate (%)
% C
hange in S
&P
500 R
etu
rns
10
Example – Time Series Modeling and
Forecasting for the S&P 500 Index
Goal:
– Model S&P 500 time series as a
combined ARIMA/GARCH
process and forecast on test data
Approach:
– Fit ARIMA model with S&P 500
returns and estimate parameters
– Fit GARCH model for S&P 500
volatility
– Perform statistical tests for time
series attributes e.g. stationarity
May-01 Feb-04 Nov-06 Aug-09 May-12
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
11000
S&
P 5
00
Realized vs All Forecasted Paths
Original Data
Simulated Data
May-01 Feb-04 Nov-06 Aug-09 May-12
800
900
1000
1100
1200
1300
1400
1500
1600
1700
1800
S&
P 5
00
Realized vs Median Forecasted Path
Original Data
Simulated Data
11
Conditional Mean
Models
Conditional Variance
Models
AR- Autoregressive
MA - Moving Average
ARIMA - Integrated
ARIMAX - eXogenous
inputs
Vector ARMA
(VARMA)
ARCH
GARCH
EGARCH
GJR
Non-Linear Models
NAR Network
NARX Network
Models for Time Series Data
12
Example – Time Series Modeling and
Forecasting for the S&P 500 Index
Numerous ARIMAX and
GARCH modeling techniques
with rich documentation
Interactive visualizations
Code parallelization to
maximize computing resources
Rapid exploration &
development
May-01 Feb-04 Nov-06 Aug-09 May-12
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
11000
S&
P 5
00
Realized vs All Forecasted Paths
Original Data
Simulated Data
May-01 Feb-04 Nov-06 Aug-09 May-12
800
900
1000
1100
1200
1300
1400
1500
1600
1700
1800
S&
P 5
00
Realized vs Median Forecasted Path
Original Data
Simulated Data
13
Overview of Time Series Modeling
Time Series Modeling with MATLAB
Parametric Modeling - Regression
ARIMA/GARCH Modeling
Summary
Agenda
14
Time Series Modeling with MATLAB
Interactive environment
– Visual tools for exploratory data analysis
– Easy to evaluate and choose best algorithm
– Simple code parallelization to maximize resources usage
– Apps available to help you get started (e.g,. import tool, database explorer, curve fitting tool)
Multiple algorithms to choose from
– Regression
– Time series analysis – ARIMAX/GARCH
– Machine learning techniques
15
Learn More: Time Series Modeling with MATLAB
To learn more, visit: http://www.mathworks.com/help/econ
/examples
Modeling the United
States Economy
16
MATLAB Central
Community for MATLAB and Simulink
users
Over 1 million visits per month
File Exchange – Upload/download access to free files
including MATLAB code, Simulink models,
and documents
– Ability to rate files, comment, and ask questions
– More than 12,500 contributed files, 300
submissions per month, 50,000 downloads
per month
Newsgroup – Web forum for technical discussions about
MathWorks products
– More than 300 posts per day
Blogs – Commentary from engineers who design, build,
and support MathWorks products
– Open conversation at blogs.mathworks.com
Based on February 2011 data
17
Training Services Exploit the full potential of MathWorks products
Flexible delivery options:
Public training available worldwide
Onsite training with standard or
customized courses
Web-based training with live, interactive
instructor-led courses
Self-paced interactive online training
More than 30 course offerings:
Introductory and intermediate training on MATLAB, Simulink,
Stateflow, code generation, and Polyspace products
Specialized courses in control design, signal processing, parallel computing,
code generation, communications, financial analysis,
and other areas
18
Migration Planning
Component Deployment
Full Application Deployment
Co
nti
nu
ou
s Im
pro
ve
me
nt
Consulting Services Accelerating return on investment
A global team of experts supporting every stage of tool and process integration
Supplier Involvement Product Engineering Teams Advanced Engineering Research
Advisory Services
Process Assessment
Jumpstart
Process and Technology
Standardization
Process and Technology
Automation
19
Technical Support
Resources
Over 100 support engineers
– All with MS degrees (EE, ME, CS)
– Local support in North America,
Europe, and Asia
Comprehensive, product-specific Web
support resources
High customer satisfaction
95% of calls answered
within three minutes
70% of issues resolved
within 24 hours
80% of customers surveyed
rate satisfaction at 80–100%
20
Questions?