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.

137

Alternatively it is possible to use the Backward Shift Operator B to provide an equivalent

condition:

(1 − B d )x t = w t (11.3)

Now that we have defined an integrated series we can define the ARIMA process itself:

Definition 11.2.2. Autoregressive Integrated Moving Average Model of order p, d, q. A time

series {x t } is an autoregressive integrated moving average model of order p, d, q, ARIMA(p,d,q),

if ∇ d x t is an autoregressive moving average model of order p,q, ARMA(p,q).

That is, if the series {x t } is differenced d times, and it then follows an ARMA(p,q) process,

then it is an ARIMA(p,d,q) series.

If we use the polynomial notation from the previous chapter on ARMA then an ARIMA(p,d,q)

process can be written in terms of the Backward Shift Operator, B:

θ p (B)(1 − B) d x t = φ q (B)w t (11.4)

Where w t is a discrete white noise series.

There are some points to note about these definitions.

Since the random walk is given by x t = x t−1 + w t it can be seen that I(1) is another

representation, since ∇ 1 x t = w t .

If we suspect a non-linear trend then we might be able to use repeated differencing (i.e. d > 1)

to reduce a series to stationary white noise. In R we can use the diff command with additional

parameters, e.g. diff(x, d=3) to carry out repeated differences.

11.2.3 Simulation, Correlogram and Model Fitting

Since we have already made use of the arima.sim command to simulate an ARMA(p,q) process,

the following procedure will be similar to that carried out in the previous chapter.

The major difference is that we will now set d = 1, that is, we will produce a non-stationary

time series with a stochastic trending component.

As before we will fit an ARIMA model to our simulated data, attempt to recover the parameters,

create confidence intervals for these parameters, produce a correlogram of the residuals of

the fitted model and finally carry out a Ljung-Box test to establish whether we have a good fit.

We are going to simulate an ARIMA(1,1,1) model, with the autoregressive coefficient α = 0.6

and the moving average coefficient β = −0.5. Here is the R code to simulate and plot such a

series, see Figure 11.1.

> set.seed(2)

> x <- arima.sim(list(order = c(1,1,1), ar = 0.6, ma=-0.5), n = 1000)

> plot(x)

Now that we have our simulated series we are going to try and fit an ARIMA(1,1,1) model

to it. Since we know the order we will simply specify it in the fit:

> x.arima <- arima(x, order=c(1, 1, 1))

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

Saved successfully!

Ooh no, something went wrong!