Saturday, 4 May 2013

Non-linearity in the Irish Stock Market

In this post, I'm going to go through an application of the BDS test using the R programming language. To be specific, I will test for non-linearity in the Irish Stock Market.

The application will involve daily data for the ISEQ index. The data spans from 1999-10-04 to 2013-05-03. There are a total of 3444 observations. Recall from my previous post that for the BDS test to have a reliable performance, the sample size should be greater than 500 observations. The data was obtained from Yahoo! Finance and you can download a .txt file of the data here.

The method that I am going to use involves taking differences of the logs of the data and then applying the BDS test to this transformed series. Note, however, that there is another method of using the BDS test to test for non-linearity which is to fit an ARIMA model (or say a GARCH model) and then to apply the BDS test to the residuals of the model. For further examples of the method that I am going to use in this post, see Chu, P.K.K. (2001) or these course notes by Eric Zivot from the University of Washington.

Let's begin by plotting the data to see what we're working with. The figure below shows a plot of the raw data.

    

The data is shown in logged form in the next figure. Generally speaking, taking logs has the effect of stabilizing the variance.


And here is the data in differences of the logs (which can be interpreted as daily percent change):


Now let's test the data expressed in differences of the logs for non-linearity. We can do this in R by using the bds.test() function from the tseries package. The hypothesis of the test is as follows:
  • H$_{0}$ : the series is i.i.d. 
  • H$_{1}$ : the series is not i.i.d. and this implies that non-linearity is present. 
The BDS test statistics are shown in the first table below and the second table contains the corresponding p-values. Note that we reject the null hypothesis at the 5% significance level when the BDS test statistic is greater in absolute value than 1.96.
BDS Test Statistics 
\begin{array}{rrrrr} \hline m & \epsilon = 0.5 & \epsilon = 1.0 & \epsilon = 1.5 & \epsilon = 2.0 \\ \hline 2 & 13.81 & 15.47 & 15.59 & 14.15 \\ 3 & 19.99 & 21.41 & 21.49 & 20.08 \\ 4 & 25.16 & 25.43 & 24.62 & 22.88 \\ 5 & 30.00 & 28.94 & 27.12 & 25.07 \\ \hline \end{array}
p-values
\begin{array}{rrrrr} \hline m & \epsilon = 0.5 & \epsilon = 1.0 & \epsilon = 1.5 & \epsilon = 2.0 \\ \hline 2 & 0.00 & 0.00 & 0.00 & 0.00 \\ 3 & 0.00 & 0.00 & 0.00 & 0.00 \\ 4 & 0.00 & 0.00 & 0.00 & 0.00 \\ 5 & 0.00 & 0.00 & 0.00 & 0.00 \\ \hline \end{array} The tables above show that all of the test statistics are greater than 1.96, so we should reject the null hypothesis of i.i.d. The p-values provide further evidence for rejecting the null.

These results suggest that the time-series data for the ISEQ index is non-linearly dependent. This evidence could be used to justify exploring the possibility of building a non-linear model for the series. Keep in mind that we'd normally like to build simpler linear models and not necessarily complicate matters by building non-linear models, but based on the evidence presented here, perhaps a non-linear approach to modelling is appropriate for this particular series.

Here is my R script for this analysis. You can use it to replicate what I've done in this post. I've also included in the script the code used for creating the LaTeX tables.

No comments:

Post a Comment