13.08.2022 Views

advanced-algorithmic-trading

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

128

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

Call:

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

Coefficients:

ar1 ma1 intercept

-0.3957 0.4503 0.0538

s.e. 0.3727 0.3617 0.0337

sigma^2 estimated as 1.053: log likelihood = -1444.79, aic = 2897.58

We can calculate the confidence intervals for each parameter using the standard errors:

> -0.396 + c(-1.96, 1.96)*0.373

[1] -1.12708 0.33508

> 0.450 + c(-1.96, 1.96)*0.362

[1] -0.25952 1.15952

The confidence intervals do contain the true parameter values for both cases but we should

note that the 95% confidence intervals are very wide. This is a consequence of the reasonably

large standard errors.

Let us now try an ARMA(2,2) model. That is, an AR(2) model combined with a MA(2)

model. We need to specify four parameters for this model: α 1 , α 2 , β 1 and β 2 . Let us take

α 1 = 0.5, α 2 = −0.25 β 1 = 0.5 and β 2 = −0.3:

> set.seed(1)

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

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

Saved successfully!

Ooh no, something went wrong!