I was a bit frustrated when I read Aris's comment to this post about speed of his calculations in Matlab. So I changed the time span of my dataset to 5 years and repeated the whole code. It was VERY disappointing to get the results after more than 5 hours! That's really REALLY bad! I migrated from Matlab to R because it is FREE and has wide community support.. but this? What's wrong?
I tried to find the most time consuming piece of code and after a few try-and-fails I finally identified the Bugbear in my code:
Alright, that's me when I saw the slow piece of code.. exactly these line:
m <- lm(z[, j] ~ z[, i] + 0)
The thing is that the variable z is a ZOO object! When I used coredata on it before the big for-loop I achieved MUCH better results: before ~ 5 hours, now ~ 30 min. That's a huge and significant difference. Moreover, in the 5 hours was JUST the code from the first part of cointegration tutorial and in the 30 minutes were both first and second part (or to better say their combination).
Do you have experienced similar issues when you used zoo objects?
I am going to try run this code using the Revolution Analytics version of R.