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.

130

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

β 2 = −0.3

[1] -0.296816 -0.161184

> 0.319 + c(-1.96, 1.96)*0.0792

[1] 0.163768 0.474232

> -0.552 + c(-1.96, 1.96)*0.0771

[1] -0.703116 -0.400884

Notice that the confidence intervals for the coefficients for the moving average component

(β 1 and β 2 ) do not actually contain the original parameter value. This outlines the danger of

attempting to fit models to data, even when we know the true parameter values.

However for trading purposes we only need to have a predictive power that reasonably exceeds

chance, producing sufficient trading revenue above transaction costs in order to be profitable in

the long run.

Now that we have seen some examples of simulated ARMA models we need a mechanism for

choosing the values of p and q when fitting to the models to real financial data.

10.6.6 Choosing the Best ARMA(p,q) Model

In order to determine which order p, q of the ARMA model is appropriate for a series, we need

to use the AIC (or BIC) across a subset of values for p, q, and then apply the Ljung-Box test to

determine if a good fit has been achieved, for particular values of p, q.

To show this method we are going to firstly simulate a particular ARMA(p,q) process. We

will then loop over all pairwise values of p ∈ {0, 1, 2, 3, 4} and q ∈ {0, 1, 2, 3, 4} and calculate

the AIC. We will select the model with the lowest AIC and then run a Ljung-Box test on the

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

Saved successfully!

Ooh no, something went wrong!