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.

119

Let us try a MA(2) model:

> amznrt.ma <- arima(amznrt, order=c(0, 0, 2))

> amznrt.ma

Call:

arima(x = amznrt, order = c(0, 0, 2))

Coefficients:

ma1 ma2 intercept

-0.0254 -0.0689 0.0012

s.e. 0.0215 0.0217 0.0005

sigma^2 estimated as 0.0007011: log likelihood = 4801.02, aic = -9594.05

Both of the estimates for the β coefficients are negative. Let us plot the residuals once again,

given in Figure 10.14.

> acf(amznrt.ma$res[-1])

Figure 10.14: Residuals of MA(2) Model Fitted to AMZN Daily Log Prices

We can see that there is almost zero autocorrelation in the first few lags. However, we have

five marginally significant peaks at lags k = 12, k = 16, k = 19, k = 25 and k = 27. This is

suggestive that the MA(2) model is capturing a lot of the autocorrelation, but not all of the

long-memory effects. How about a MA(3) model?

> amznrt.ma <- arima(amznrt, order=c(0, 0, 3))

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

Saved successfully!

Ooh no, something went wrong!