Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Time series analysis- Part 2
1. Time Series Analysis Workshop
2018 Copyright QuantUniversity LLC.
Presented By:
Sri Krishnamurthy, CFA, CAP
sri@quantuniversity.com
www.quantuniversity.com
12/20/2018
QuantUniversity Meetup
Boston
2. 2
About us:
• Data Science, Quant Finance and
Model Governance Advisory
• Technologies using MATLAB, Python
and R
• Programs
▫ Analytics Certificate Program
▫ Fintech programs
• Platform
4. • Founder of QuantUniversity LLC. and
www.analyticscertificate.com
• Advisory and Consultancy for Financial Analytics
• Prior Experience at MathWorks, Citigroup and
Endeca and 25+ financial services and energy
customers.
• Regular Columnist for the Wilmott Magazine
• Author of forthcoming book
“Financial Modeling: A case study approach”
published by Wiley
• Charted Financial Analyst and Certified Analytics
Professional
• Teaches Analytics in the Babson College MBA
program and at Northeastern University, Boston
Sri Krishnamurthy
Founder and CEO
4
5. 5
• 2-day Advances in Time series Workshop
▫ Febraury - TBD
▫ Stay tuned for details at www.analyticscertificate.com
• 2-day Machine Learning in Finance Workshop
▫ Jan 23rd & 24th
▫ Register at www.analyticscertificate.com/MachineLearning
Upcoming events
8. • PhD in economics from Boston
University
• Associate teaching professor in the
Department of Economics at
Northeastern University
• Teaches courses at Northeastern
University, Harvard University and
Boston College
• Prior experience at Analysis Group, An
economic consulting
Gustavo Vincentini, PhD
QuantUniversity Fellow
8
9. Principles of Econometrics, 4th Edition Page 9
Chapter 9: Regression with Time Series Data:
Stationary Variables
¡ Time-series data are widely encountered in macroeconomics
and finance
¡ “quarterly U.S. real GDP per capita” Q1’81 – Q4’17
¡ “yearly unemployment rate in MA” 1973 – 2017
¡ “daily closing Google stock price” 1/1/08 – 12/30/16
¡ Econometrics is very useful when analyzing time-series data
¡ Policy analysis
¡ If Fed decreases interest rate this quarter, how is current
and future GDP growth affected?
¡ Forecasting
¡ What is a good forecast for inflation rate next quarter?
¡ Before using regression on time-series data, one needs to check
whether the series are stationary or non-stationary
Introduction
10. Principles of Econometrics, 4th Edition Page 10
Chapter 9: Regression with Time Series Data:
Stationary Variables
Examples of stationary vs non-stationary data
Stationary Non-stationary Non-stationary
First thing to do is to test if series is non-stationary. If it is non-stationary, then need to convert it
to its stationary version before using it in regression analysis. (How to test for non-stationarity will
be addressed later.) If series is already stationary, then it’s ready for analysis. For the time being,
let’s assume that your data are stationary and “ready” for OLS regression analysis
A series is stationary if it
hovers around its mean.
A series is non-stationary if it
either trends (upward or
downward) or it wanders
around with slow turns and
without necessarily returning to
its mean.
11. Principles of Econometrics, 4th Edition Page 11
Chapter 9: Regression with Time Series Data:
Stationary Variables
Using time-series econometrics
for policy analysis
Suppose you have data on quarterly real GDP growth rate (“y”
variable) and quarterly interest rate (“x” variable). Assume both
series are stationary (and therefore ready for regression analysis)
One may hypothesize that a decrease in interest rate now would affect
not only current but also future GDP growth (i.e., monetary policy)
This hypothesis can be tested by a regression model in which y
depends on current and “q” lagged values of x
This model is of primary interest to central banks (e.g., the Fed). For
example, β0 is the effect of a change in interest rate on current
growth, while β2 is the effect two quarters into the future
If both the x and y series are stationary, then one can use OLS
regression to estimate the β’s. This would provide a quantification of
the effect of monetary policy on economic growth over time
A lag selection criterion, such as the BIC (“Bayes Information
Criterion”), can be used to select the optimal “q”
0 1 1 2 2t t t t q t q ty x x x x e- - -= a +b +b +b + +b +!
12. Principles of Econometrics, 4th Edition Page 12
Chapter 9: Regression with Time Series Data:
Stationary Variables
Using time-series econometrics
for forecasting
After running the OLS regression and estimating the β’s, one can
forecast future GDP growth. For example, if “T” is current
quarter, then a one-quarter-ahead (“T+1”) forecast for growth
is:
(Note how one would also need a forecast for xT+1)
One can then calculate a standard error for the forecast yT+1,
and then use it to construct a 95% confidence interval for yT+1.
The narrower the confidence interval, the more confident you are
on your forecast
One could also calculate, for example, a two-quarters-ahead
forecast and confidence interval
1 0 1 1 2 1 1 1T T T T q T q Ty x x x x e+ + - - + += a +b +b +b + +b +!
13. Principles of Econometrics, 4th Edition Page 13
Chapter 9: Regression with Time Series Data:
Stationary Variables
An application of policy analysis:
Okun’s Law (I)
Consider the “theoretical” version of Okun’s Law, where “U” is
unemployment rate and “G” is GDP growth rate
The change in unemployment rate depends on how the growth rate
deviates from a “normal” growth rate “GN”
It can be re-written into its “econometric” version:
where: DU = Ut – Ut-1 , β0 = –γ , and α = γGN
Lags of growth can be included:
If both the “DU” and the “G” series are stationary, then OLS
regression can be applied to estimate the coefficients
( )1t t t NU U G Gg-- = - -
0βt t tDU G ea= + +
0 1 1 2 2β β β βt t t t q t q tDU G G G G ea - - -= + + + + + +!
14. Principles of Econometrics, 4th Edition Page 14
Chapter 9: Regression with Time Series Data:
Stationary Variables
An application of policy analysis:
Okun’s Law (II)
§ Quarterly U.S. data:
“DU” “G”
15. Principles of Econometrics, 4th Edition Page 15
Chapter 9: Regression with Time Series Data:
Stationary Variables
An application of policy analysis:
Okun’s Law (III)
§ OLS regression results:
§ Recall: “Optimal” number of lags can be selected with BIC
16. Principles of Econometrics, 4th Edition Page 16
Chapter 9: Regression with Time Series Data:
Stationary Variables
Estimation when the error terms
are serially correlated (I)
§ Many economic time-series are serially correlated. (Also called
“auto” correlated.) That is, if its current value is relatively high
(low), then its next period’s value is also likely to be high (low).
For example, U.S. quarterly real GDP growth (“G”)
§ This serial correlation can be quantified by calculating the
correlation coefficient between, Gt and Gt-1, labeled “r1”
§ Correlation coefficients always fall between -1 and +1.
§ One can also calculate the correlation between Gt and Gt-2,
labeled “r2”, and so on…
17. Principles of Econometrics, 4th Edition Page 17
Chapter 9: Regression with Time Series Data:
Stationary Variables
Estimation when the error terms
are serially correlated (II)
§ The correlation coefficients r1, r2, r3, etc, can also be calculated and
visualized with a correlogram. For example, for growth rate G:
§ The solid lines at 0.2 and -0.2 delineate thresholds for correlation
coefficients that are statistically different from zero. For example, current
growth is correlated with last-period’s growth and two-periods-ago growth
1 2 3 40.494 0.411 0.154 0.200r r r r= = = =
18. Principles of Econometrics, 4th Edition Page 18
Chapter 9: Regression with Time Series Data:
Stationary Variables
Estimation when the error terms
are serially correlated (III)
§ Serial correlation becomes an issue in econometrics when the error terms are serially
correlated
§ Consider another economic example, the Phillips Curve
§ Assume inflationary expectations (INFE
t) are constant over time (β1 = INFE
t), set β2= –γ, and
add an error term:
§ One way to check if et and et-1 are serially correlated is to run an OLS regression of INFt on
DUt , collect the residuals after the regression:
§ And then plot correlogram for residuals:
( )1γE
t t t tINF INF U U -= - -
1 2β βt t tINF DU e= + +
1 2
ˆt t te INF b b DU= - - +
19. Principles of Econometrics, 4th Edition Page 19
Chapter 9: Regression with Time Series Data:
Stationary Variables
Estimation when the error terms
are serially correlated (IV)
§ So, what is the “issue” when the errors are serially correlated?
§ The estimated β2 from the OLS regression is unbiased, which is a desirable thing. However,
the typically reported “regular” standard errors are no longer valid, and typically smaller
then they should be.
§ What to do? There are two potential solutions:
1) Use “proper” standard errors that accommodate the serial correlation in the error
terms, called “HAC” standard errors (Heteroskedasticity- and AutoCorrelation-robust
standard errors)
2) Include lagged values of the INF variable and/or further lagged values of the DU
variable in the OLS regression until the serial correlation in the residuals disappears.
For example, including a lagged INFt-1:
( ) ( ) ( )
( ) ( ) ( )
0.7776 0.5279
0.0658 0.2294 incorrect se
0.1030 0.3127 HAC se
INF DU= -
( ) ( ) ( ) ( )
10.3548 0.5282 0.4909
0.0876 0.0851 0.1921
t t tINF INF DU
se
-= + -
20. Principles of Econometrics, 4th Edition Page 20
Chapter 9: Regression with Time Series Data:
Stationary Variables
§ What does it mean for a y series to be non-stationary? The most common type of non-
stationarity in time-series is a unit root, which is a series that “wanders around”
aimlessly (and with “slow turns”) without possibly never returning to its mean. Visually:
§ Many macroeconomic series are non-stationary (e.g., inflation rate, exchange rates)
§ If a series y (or x) is non-stationary, then one should not use it (in its “raw” form) in an
OLS regression, because the OLS estimator does not behave well in such case.
§ Instead, one should first transform it into a stationary version of itself and then use that
version in a regression. The transformation is quite simple: Just take the first-difference of
the series, Dyt = yt – yt-1, and use it in the OLS regression. (Dyt is stationary.)
§ For example, if both y and x are non-stationary, you should
Use: Dyt = β0 + β1 Dxt + ut And not use: yt = β0 + β1 xt + ut
Non-stationary time series (I)
21. Principles of Econometrics, 4th Edition Page 21
Chapter 9: Regression with Time Series Data:
Stationary Variables
§ So why can’t we use the “raw” version of a non-stationary series in an
OLS regression? Because you may find a spurious result in your OLS
regression. This issue is termed “spurious regression”
§ For example, consider these two unit roots that were independently
simulated. In other words, they are not related to each other:
§ An OLS regression of rw1 on rw2 yields:
§ These results are statistically significant (t = 40.8 and R2 = 0.70!!), but
completely meaningless, or spurious. The apparent significance is false
Non-stationary time series (II)
2
1 217.818 0.842 , 0.70
( ) (40.837)
t trw rw R
t
= + =
22. Principles of Econometrics, 4th Edition Page 22
Chapter 9: Regression with Time Series Data:
Stationary Variables
§ Therefore, the first thing one should do when working
with a time-series is to test whether it is non-stationary
or stationary
§ If the series is found to be stationary, then you should
work with the series itself (without taking its first-
difference)
§ If the series is found to be non-stationary, then you
should work with its first-difference in regression
analysis
§ The most commonly used test for stationarity of a series is
the Dickey-Fuller (“DF”) test
Non-stationary time series (III)
23. 23
1. Acceptance of the Open Source world
2. Data Science is a need-to-have skill
3. AI and ML taken seriously
4. Major innovations in Deep Learning and Reinforcement Learning
5. Limitations in Deep Learning and Chatbots recognized
6. AutoML maturing
7. Analytics back in demand
8. Realization that clean and labeled data is king!
9. AI, ML ops leveraging advances in Devops
10. Realization that AI and ML is not simple
Top 10 developments in 2018
24. 24
1. Every organization thinking of an AI strategy
2. AI and ML operationalized
3. Reproducibility, Replicability, Model Governance
4. Bias, Interpretability, Auditability, Explainability
5. More innovations in applied Machine Learning – From research
labs to enterprises
What’s coming in 2019
25. 25
• QuSandbox launch!
• Analytics Certificate 9 week program in Spring 2019
• More courses
▫ AI & ML in Finance
▫ Time Series Analysis Workshop
▫ Anomaly Detection
▫ Fintech 101
QuantUniversity in 2019
27. Sri Krishnamurthy, CFA, CAP
Founder and Chief Data Scientist
sri@quantuniversity.com
srikrishnamurthy
www.QuantUniversity.com
www.analyticscertificate.com
www.qusandbox.com
Information, data and drawings embodied in this presentation are strictly a property of QuantUniversity LLC. and shall not be
distributed or used in any other publication without the prior written consent of QuantUniversity LLC.
27