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.

116

Coefficients:

ma1 intercept

-0.7298 0.0486

s.e. 0.1008 0.0246

sigma^2 estimated as 0.7841: log likelihood = -130.11, aic = 266.23

ˆβ 1 = −0.730, which is a small underestimate of β 1 = −0.6.

confidence interval:

Finally, let us calculate the

> -0.730 + c(-1.96, 1.96)*0.1008

[1] -0.927568 -0.532432

We can see that the true parameter value of β 1 = −0.6 is contained within the 95% confidence

interval, providing us with evidence of a good model fit.

MA(3)

We can run through the same procedure for a MA(3) process. This time we should expect

significant peaks at k ∈ {1, 2, 3}, and insignificant peaks for k > 3.

We are going to use the following coefficients: β 1 = 0.6, β 2 = 0.4 and β 3 = 0.3. Let us

simulate a MA(3) process from this model. I have increased the number of random samples to

1000 in this simulation, which makes it easier to see the true autocorrelation structure at the

expense of making the original series harder to interpret:

> set.seed(3)

> x <- w <- rnorm(1000)

> for (t in 4:1000) x[t] <- w[t] + 0.6*w[t-1] + 0.4*w[t-2] + 0.3*w[t-3]

> layout(1:2)

> plot(x, type="l")

> acf(x)

The output is given in Figure 10.12.

As expected the first three peaks are significant. However, so is the fourth. But we can

legitimately suggest that this may be due to sampling bias as we expect to see 5% of the peaks

being significant beyond k = q.

We can now fit a MA(3) model to the data to try and estimate parameters:

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

> x.ma

Call:

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

Coefficients:

ma1 ma2 ma3 intercept

0.5439 0.3450 0.2975 -0.0948

s.e. 0.0309 0.0349 0.0311 0.0704

sigma^2 estimated as 1.039: log likelihood = -1438.47, aic = 2886.95

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

Saved successfully!

Ooh no, something went wrong!