Predict a random time series

08Oct10

Now and then it is worth checking how the ANN performs in completely random time series. This technique is invaluable and often neglected. A couple times, it revealed that there were some bugs in the code. The basic idea is that the ANN can learn the random series, but the prediction power should be zero. If the ANN can predict the completely random time series that means there is a serious bug in the code.

A couple of months ago this technique showed me that my code had a bug in which the ANN could use training samples that was actually in the future. So, the ANN learned the future and it could predict even the random sequence.

This how I construct the ‘virtual’ (random) RUT index:

randPercChange = random('Normal', 1, 0.01, length(indexCloses), 1); % 1percent stddev
randSeries = ones(length(indexCloses), 1);
randSeries(1) = indexCloses(1);
for i=2:length(indexCloses)
randSeries(i) = randSeries(i - 1) * randPercChange(i - 1);
end
indexCloses = randSeries;

I show the statistics here:

Luckily, the ANN couldn’t predict the random sequence. This is a necessary, but not sufficient condition for proving that the ANN implementation is correct.
It is a good to see that the same ANN code had a directional accuracy for the random RUT at about 50%, it has a directional accuracy for the real RUT at about 53%. Trying to refute the random walk theory of stock markets, we conclude that in real life, the RUT daily returns cannot be random, because it can be predicted.

Advertisements


No Responses Yet to “Predict a random time series”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: