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.

108

Figure 10.6: Correlogram of First Order Differenced Daily Logarithmic Returns of AMZN Closing

Prices.

[,1] [,2]

[1,] 4.59499e-04 1.19519e-05

[2,] 1.19519e-05 4.59499e-04

Fitting the ar autoregressive model to the first order differenced series of log prices produces

an AR(2) model, with ˆα 1 = −0.0278 and ˆα 2 = −0.0687. I have also output the aysmptotic

variance so that we can calculate standard errors for the parameters and produce confidence

intervals. We want to see whether zero is part of the 95% confidence interval, as if it is, it

reduces our confidence that we have a true underlying AR(2) process for the AMZN series.

To calculate the confidence intervals at the 95% level for each parameter, we use the following

commands. We take the square root of the first element of the asymptotic variance matrix to

produce a standard error, then create confidence intervals by multiplying it by -1.96 and 1.96

respectively, for the 95% level:

> -0.0278 + c(-1.96, 1.96)*sqrt(4.59e-4)

[1] -0.0697916 0.0141916

> -0.0687 + c(-1.96, 1.96)*sqrt(4.59e-4)

[1] -0.1106916 -0.0267084

Note that this becomes more straightforward when using the arima function, but we will wait

until the next chapter before introducing it properly.

Thus we can see that for α 1 zero is contained within the confidence interval, while for α 2 zero

is not contained in the confidence interval. Hence we should be very careful in thinking that we

really have an underlying generative AR(2) model for AMZN.

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

Saved successfully!

Ooh no, something went wrong!