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.

127

We can start with the simplest possible non-trivial ARMA model–the ARMA(1,1) model.

This is an autoregressive model of order one combined with a moving average model of order

one. Such a model has only two coefficients, α and β, which represent the first lags of the time

series itself and the "shock" white noise terms. The model is given by:

x t = αx t−1 + w t + βw t−1 (10.20)

We need to specify the coefficients prior to simulation. Let us take α = 0.5 and β = −0.5:

> set.seed(1)

> x <- arima.sim(n=1000, model=list(ar=0.5, ma=-0.5))

> plot(x)

The output is given in Figure 10.19.

Figure 10.19: Realisation of an ARMA(1,1) Model, with α = 0.5 and β = −0.5

Let us also plot the correlogram, as given in Figure 10.20.

> acf(x)

We can see that there is no significant autocorrelation, which is to be expected from an

ARMA(1,1) model.

Finally, let us try and determine the coefficients and their standard errors using the arima

function:

> arima(x, order=c(1, 0, 1))

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

Saved successfully!

Ooh no, something went wrong!