13.08.2022 Views

advanced-algorithmic-trading

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

158

x t = pz t + w x,t (12.1)

y t = qz t + w y,t (12.2)

If we then take a linear combination ax t + by t :

ax t + by t = a(pz t + w x,t ) + b(qz t + w y,t ) (12.3)

= (ap + bq)z t + aw x,t + bw y,t (12.4)

We see that we only achieve a stationary series (that is a combination of white noise terms)

if ap + bq = 0. We can put some numbers to this to make it more concrete. Suppose p = 0.3 and

q = 0.6. After some simple algebra we see that if a = 2 and b = −1 we have that ap + bq = 0,

leading to a stationary series combination. Hence x t and y t are cointegrated when a = 2 and

b = −1.

We can simulate this in R in order to visualise the stationary combination. Firstly, we wish

to create and plot the underlying random walk series, z t :

> set.seed(123)

> z <- rep(0, 1000)

> for (i in 2:1000) z[i] <- z[i-1] + rnorm(1)

> plot(z, type="l")

Figure 12.1: Realisation of a random walk, z t

If we plot both the correlogram of the series and its differences we can see little evidence of

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!