Introduction to Algorithmic Trading Strategies Lecture 3

Similar documents
Econ 423 Lecture Notes: Additional Topics in Time Series 1

Multivariate Time Series: Part 4

ECON 4160, Spring term Lecture 12

ECON 4160, Lecture 11 and 12

Lecture 5: Unit Roots, Cointegration and Error Correction Models The Spurious Regression Problem

Financial Econometrics

TESTING FOR CO-INTEGRATION

Y t = ΦD t + Π 1 Y t Π p Y t p + ε t, D t = deterministic terms

Market efficiency of the bitcoin exchange rate: applications to. U.S. dollar and Euro

VAR Models and Cointegration 1

BCT Lecture 3. Lukas Vacha.

It is easily seen that in general a linear combination of y t and x t is I(1). However, in particular cases, it can be I(0), i.e. stationary.

Vector error correction model, VECM Cointegrated VAR

Cointegration, Stationarity and Error Correction Models.

Modelling of Economic Time Series and the Method of Cointegration

Questions and Answers on Unit Roots, Cointegration, VARs and VECMs

Cointegration and Error Correction Exercise Class, Econometrics II

An Application of Cointegration Analysis on Strategic Asset Allocation

Chapter 2: Unit Roots

Cointegration Lecture I: Introduction

EC408 Topics in Applied Econometrics. B Fingleton, Dept of Economics, Strathclyde University

Advanced Econometrics

9) Time series econometrics

Cointegration and Error-Correction

7. Integrated Processes

Stationarity and cointegration tests: Comparison of Engle - Granger and Johansen methodologies

Empirical Market Microstructure Analysis (EMMA)

Cointegrated VAR s. Eduardo Rossi University of Pavia. November Rossi Cointegrated VAR s Fin. Econometrics / 31

Lecture 8a: Spurious Regression

7. Integrated Processes

Cointegrated VAR s. Eduardo Rossi University of Pavia. November Rossi Cointegrated VAR s Financial Econometrics / 56

Multivariate Time Series: VAR(p) Processes and Models

1 Regression with Time Series Variables

Cointegration. Example 1 Consider the following model: x t + βy t = u t (1) x t + αy t = e t (2) u t = u t 1 + ε 1t (3)

Lecture 8a: Spurious Regression

Unit roots in vector time series. Scalar autoregression True model: y t 1 y t1 2 y t2 p y tp t Estimated model: y t c y t1 1 y t1 2 y t2

ARDL Cointegration Tests for Beginner

Regression with random walks and Cointegration. Spurious Regression

Economtrics of money and finance Lecture six: spurious regression and cointegration

Modeling Long-Run Relationships

Multivariate Time Series Analysis and Its Applications [Tsay (2005), chapter 8]

10) Time series econometrics

Lecture 5: Unit Roots, Cointegration and Error Correction Models The Spurious Regression Problem

Modelling Electricity Demand in New Zealand

Non-Stationary Time Series, Cointegration, and Spurious Regression

CHAPTER III RESEARCH METHODOLOGY. trade balance performance of selected ASEAN-5 countries and exchange rate

Testing for non-stationarity

MFE Financial Econometrics 2018 Final Exam Model Solutions

Bootstrapping the Grainger Causality Test With Integrated Data

Topic 4 Unit Roots. Gerald P. Dwyer. February Clemson University

E 4160 Autumn term Lecture 9: Deterministic trends vs integrated series; Spurious regression; Dickey-Fuller distribution and test

Regression: Ordinary Least Squares

Multivariate forecasting with VAR models

1 Quantitative Techniques in Practice

Econometrics II. Seppo Pynnönen. January 14 February 27, Department of Mathematics and Statistics, University of Vaasa, Finland

Prof. Dr. Roland Füss Lecture Series in Applied Econometrics Summer Term Introduction to Time Series Analysis

Aviation Demand and Economic Growth in the Czech Republic: Cointegration Estimation and Causality Analysis

Introduction to Algorithmic Trading Strategies Lecture 10

Volume 30, Issue 1. EUAs and CERs: Vector Autoregression, Impulse Response Function and Cointegration Analysis

Darmstadt Discussion Papers in Economics

Measuring price discovery in agricultural markets

Time Series Forecasting Model for Chinese Future Marketing Price of Copper and Aluminum

Non-Stationary Time Series and Unit Root Testing

Multivariate Time Series

11. Further Issues in Using OLS with TS Data

CO INTEGRATION: APPLICATION TO THE ROLE OF INFRASTRUCTURES ON ECONOMIC DEVELOPMENT IN NIGERIA

THE LONG-RUN DETERMINANTS OF MONEY DEMAND IN SLOVAKIA MARTIN LUKÁČIK - ADRIANA LUKÁČIKOVÁ - KAROL SZOMOLÁNYI

E 4101/5101 Lecture 9: Non-stationarity

International Monetary Policy Spillovers

Sample Exam Questions for Econometrics

Test for Structural Change in Vector Error Correction Models 1

A Non-Parametric Approach of Heteroskedasticity Robust Estimation of Vector-Autoregressive (VAR) Models

THE LONG RUN RELATIONSHIP BETWEEN SAVING AND INVESTMENT IN INDIA

Numerically Stable Cointegration Analysis

FE570 Financial Markets and Trading. Stevens Institute of Technology

Are US Output Expectations Unbiased? A Cointegrated VAR Analysis in Real Time

An Econometric Modeling for India s Imports and exports during

A TIME SERIES PARADOX: UNIT ROOT TESTS PERFORM POORLY WHEN DATA ARE COINTEGRATED

Is the Basis of the Stock Index Futures Markets Nonlinear?

Non-Stationary Time Series and Unit Root Testing

Why Segregating Cointegration Test?

A Test of Cointegration Rank Based Title Component Analysis.

The Effects of Ignoring Level Shifts on Systems Cointegration Tests

Volatility. Gerald P. Dwyer. February Clemson University

Time series: Cointegration

CHAPTER 21: TIME SERIES ECONOMETRICS: SOME BASIC CONCEPTS

Stock market cointegration in Europe

Unit Root and Cointegration

On the robustness of cointegration tests when series are fractionally integrated

Stationarity and Cointegration analysis. Tinashe Bvirindi

Lecture 3 Macroeconomic models by VAR

The causal relationship between energy consumption and GDP in Turkey

The Geometric Meaning of the Notion of Joint Unpredictability of a Bivariate VAR(1) Stochastic Process

This chapter reviews properties of regression estimators and test statistics based on

Introduction to Modern Time Series Analysis

Lecture 2: Univariate Time Series

APPLIED TIME SERIES ECONOMETRICS

Cointegration Analysis in the Case of I(2) General Overview

Wesleyan Economic Working Papers

GARCH Models. Eduardo Rossi University of Pavia. December Rossi GARCH Financial Econometrics / 50

Transcription:

Introduction to Algorithmic Trading Strategies Lecture 3 Pairs Trading by Cointegration Haksun Li haksun.li@numericalmethod.com www.numericalmethod.com

Outline Distance method Cointegration Stationarity Dickey Fuller tests 2

References Pairs Trading: A Cointegration Approach. Arlen David Schmidt. University of Sydney. Finance Honours Thesis. November 2008. Likelihood-Based Inference in Cointegrated Vector Autoregressive Models. Soren Johansen. Oxford University Press, USA. February 1, 1996. 3

Pairs Trading Definition: trade one asset (or basket) against another asset (or basket) Long one and short the other Intuition: For two closely related assets, they tend to move together (common trend). We want to buy the cheap one and sell the expensive one. Exploit short term deviation from long term equilibrium. Try to make money from spread. 4

Spread Z = X βy β hedge ratio cointegration coefficient 5

Dollar Neutral Hedge Suppose ES (S&P500 E-mini future) is at 1220 and each point worth $50, its dollar value is about $61,000. Suppose NQ (Nasdaq 100 E-mini future) is at 1634 and each point worth $20, its dollar value is $32,680. β = 61000 = 1.87. 32680 Z = EE 1.87 NN Buy Z = Buy 10 ES contracts and Sell 19 NQ contracts. Sell Z = Sell 10 ES contracts and Buy 19 NQ contracts. 6

Market Neutral Hedge Suppose ES has a beta of 1.25, NQ 1.11. We use β = 1.25 1.11 = 1.13 7

Dynamic Hedge β changes with time, covariance, market conditions, etc. Periodic recalibration. 8

Distance The distance between two time series: d = x i y j 2 x i, y j are the normalized prices. We choose a pair of stocks among a collection with the smallest distance, d. 9

Distance Trading Strategy Sell Z if Z is too expensive. Buy Z if Z is too cheap. How do we do the evaluation? 10

Z Transform We normalize Z. The normalized value is called z-score. z = x x σ x Other forms: z = x M x S σ x M, S are proprietary functions for forecasting. 11

A Very Simple Distance Pairs Trading Sell Z when z > 2 (standard deviations). Sell 10 ES contracts and Buy 19 NQ contracts. Buy Z when z < -2 (standard deviations). Buy 10 ES contracts and Sell 19 NQ contracts. 12

Pros of the Distance Model Model free. No mis-specification. No mis-estimation. Distance measure intuitively captures the LOP idea. 13

Cons of the Distance Model Does not guarantee stationarity. Cannot predict the convergence time (expected holding period). Ignores the dynamic nature of the spread process, essentially treat the spread as i.i.d. Using more strict criterions works for equity. In fixed income trading, we don t have the luxury of throwing away many pairs. 14

Risks in Pairs Trading Long term equilibrium does not hold. Systematic market risk. Firm specific risk. Liquidity. 15

Stationarity These ad-hoc βcalibration does not guarantee the single most important statistical property in trading: stationarity. Strong stationarity: the joint probability distribution of x t does not change over time. Weak stationarity: the first and second moments do not change over time. Covariance stationarity 16

Cointegration Cointegration: select a linear combination of assets to construct an (approximately) stationary portfolio. A stationary stochastic process is mean-reverting. Long when the spread/portfolio/basket falls sufficiently below a long term equilibrium. Short when the spread/portfolio/basket rises sufficiently above a long term equilibrium. 17

Objective Given two I(1) price series, we want to find a linear combination such that: z t = x t βy t = μ + ε t ε t is I(0), a stationary residue. μ is the long term equilibrium. Long when z t < μ Δ. Sell when z t > μ + Δ. 18

Stocks from the Same Industry Reduce market risk, esp., in bear market. Stocks from the same industry are likely to be subject to the same systematic risk. Give some theoretical unpinning to the pairs trading. Stocks from the same industry are likely to be driven by the same fundamental factors (common trends). 19

Cointegration Definition X t ~CI d, b if All components of X t are integrated of same order d. There exists a β t such that the linear combination,β t X t = β 1 X 1t + β 2 X 2t + + β n X nt, is integrated of order d b, b > 0. βis the cointegrating vector, not unique. 20

Illustration for Trading Suppose we have two assets, both reasonably I(1), we want to find β such that Z = X + βy is I(0), i.e., stationary. In this case, we have d = 1, b = 1. 21

A Simple VAR Example y t = a 11 y t 1 + a 12 z t 1 + ε yy z t = a 21 y t 1 + a 22 z t 1 + ε zt Theorem 4.2, Johansen, places certain restrictions on the coefficients for the VAR to be cointegrated. The roots of the characteristics equation lie on or outside the unit disc. 22

Coefficient Restrictions a 11 = 1 a 22 a 12 a 21 1 a 22 a 22 > 1 a 12 a 21 + a 22 < 1 23

VECM (1) Taking differences y t y t 1 = a 11 1 y t 1 + a 12 z t 1 + ε yy z t z t 1 = a 21 y t 1 + a 22 1 z t 1 + ε zt Δy t Δz t = a 11 1 a 12 a 21 a 22 1 y t 1 z t 1 + ε yy ε zt Substitution of a 11 Δy t Δz t = a 12 a 21 1 a 22 a 12 a 21 a 22 1 y t 1 z t 1 + ε yy ε zt 24

VECM (2) Δy t = α y y t 1 βz t 1 Δz t = α z y t 1 βz t 1 α y = a 12a 21 1 a 22 + ε yy + ε zt α z = a 21 β = 1 a 22, the cointegrating coefficient a 21 y t 1 βz t 1 is the long run equilibrium, I(0). α y, α z are the speed of adjustment parameters. 25

Interpretation Suppose the long run equilibrium is 0, Δy t, Δz t responds only to shocks. Suppose α y < 0, α z > 0, y t decreases in response to a +ve deviation. z t increases in response to a +ve deviation. 26

Granger Representation Theorem If X t is cointegrated, an VECM form exists. The increments can be expressed as a functions of the dis-equilibrium, and the lagged increments. ΔX t = αβ X t 1 + c t ΔX t 1 + ε t In our simple example, we have Δy t Δz t = α y α z 1 β y t 1 z t 1 + ε yy ε zt 27

Granger Causality z t does not Granger Cause y t if lagged values of Δz t i do not enter the Δy t equation. y t does not Granger Cause z t if lagged values of Δy t i do not enter the Δz t equation. 28

Test for Stationarity An augmented Dickey Fuller test (ADF) is a test for a unit root in a time series sample. It is an augmented version of the Dickey Fuller test for a larger and more complicated set of time series models. Intuition: if the series y t is stationary, then it has a tendency to return to a constant mean. Therefore large values will tend to be followed by smaller values, and small values by larger values. Accordingly, the level of the series will be a significant predictor of next period's change, and will have a negative coefficient. If, on the other hand, the series is integrated, then positive changes and negative changes will occur with probabilities that do not depend on the current level of the series. In a random walk, where you are now does not affect which way you will go next. 29

ADF Math p 1 i=1 Δy t i Δy t = α + ββ + γy t 1 + + ε t Null hypothesis H 0 : γ = 0. (y t non-stationary) α = 0, β = 0 models a random walk. β = 0 models a random walk with drift. Test statistics = γ σ γ, the more negative, the more reason to reject H 0 (hence y t stationary). SuanShu: AugmentedDickeyFuller.java 30

Engle-Granger Two Step Approach Estimate either y t = β 10 + β 11 z t + e 1t z t = β 20 + β 21 y t + e 2t As the sample size increase indefinitely, asymptotically a test for a unit root in e 1t and e 2t are equivalent, but not for small sample sizes. Test for unit root using ADF on either e 1t and e 2t. If y t and z t are cointegrated, β super converges. 31

Engle-Granger Pros and Cons Pros: simple Cons: This approach is subject to twice the estimation errors. Any errors introduced in the first step carry over to the second step. Work only for two I(1) time series. 32

Testing for Cointegration Note that in the VECM, the rows in the coefficient, Π, are NOT linearly independent. Δy t Δz t = a 12 a 21 1 a 22 a 12 a 21 a 22 1 y t 1 z t 1 + ε yy ε zt a 12a 21 1 a 22 a 12 1 a 22 a 12 = a 21 a 22 1 The rank of Π determine whether the two assets y t and z t are cointegrated. 33

VAR & VECM In general, we can write convert a VAR to an VECM. VAR (from numerical estimation by, e.g., OLS): X t = p i=1 A i X t i + ε t Transitory form of VECM (reduced form) ΔX t = ΠX t 1 + p 1 i=1 Long run form of VECM ΔX t = p 1 i=1 Υ i ΔX t i Γ i ΔX t i + ε t + ΠX t p + ε t 34

The Π Matrix Rank(Π) = n, full rank The system is already stationary; a standard VAR model in levels. Rank(Π) = 0 There exists NO cointegrating relations among the time series. 0 < Rank(Π) < n Π = αβ β is the cointegrating vector α is the speed of adjustment. 35

Rank Determination Determining the rank of Π is amount to determining the number of non-zero eigenvalues of Π. Π is usually obtained from (numerical VAR) estimation. Eigenvalues are computed using a numerical procedure. 36

Trace Statistics Suppose the eigenvalues of Π are:λ 1 > λ 2 > > λ n. For the 0 eigenvalues, ln 1 λ i = 0. For the (big) non-zero eigenvalues, ln 1 λ i is (very negative). The likelihood ratio test statistics p Q H r H n = T i=r+1 log 1 λ i H0: rank r; there are at most r cointegrating β. 37

Test Procedure int r = 0;//rank for (; r <= n; ++r) { } compute Q = Q H r H n ; If (Q > c.v.) {//compare against a critical value } break;//fail to reject the null hypothesis; rank found r is the rank found 38

Decomposing Π Suppose the rank of Π = r. Π = αβ. Π is n n. α is n r. β is r n. 39

Estimating β β can estimated by maximizing the log-likelihood function in Chapter 6, Johansen. logl Ψ, α, β, Ω Theorem 6.1, Johansen: β is found by solving the following eigenvalue problem: λs 11 S 10 S 00 1 S 01 = 0 40

β Each non-zero eigenvalue λ corresponds to a cointegrating vector, which is its eigenvector. β = v 1, v 2,, v r β spans the cointegrating space. For two cointegrating asset, there are only one β (v 1 ) so it is unequivocal. When there are multiple β, we need to add economic restrictions to identify β. 41

Trading the Pairs Given a space of (liquid) assets, we compute the pairwise cointegrating relationships. For each pair, we validate stationarity by performing the ADF test. For the strongly mean-reverting pairs, we can design trading strategies around them. 42