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.

115

[1] 0.440208 0.764392

We can see that the 95% confidence interval contains the true parameter value of β 1 = 0.6

and so we can judge the model a good fit. Obviously this should be expected since we simulated

the data in the first place.

How do things change if we modify the sign of β 1 to -0.6? We can perform the same analysis:

> set.seed(1)

> x <- w <- rnorm(100)

> for (t in 2:100) x[t] <- w[t] - 0.6*w[t-1]

> layout(1:2)

> plot(x, type="l")

> acf(x)

The output is given in Figure 10.11.

Figure 10.11: Realisation of MA(1) Model, with β 1 = −0.6 and Associated Correlogram

We can see that at k = 1 we have a significant peak in the correlogram, except that it shows

negative correlation, as we would expect from a MA(1) model with negative first coefficient.

Once again all peaks beyond k = 1 are insignificant. Let us fit a MA(1) model and estimate the

parameter:

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

> x.ma

Call:

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

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

Saved successfully!

Ooh no, something went wrong!