# ARIMA model fitting and forecasting implementation

I am new to time series modelling and I am trying to build a simple time series model using ARIMA methodology and forecast. I could write an R program to do the same, but I am more interested in writing my own arima(1,1,0) and predict() functions that R provides in Java / C++ / Python. While I can go about reading the theory behind ARIMA modeling and then implementing it, I still face a learning curve there, due to time constraints, I would like to take an approach where I can see a time series data sample, and a write up which walks me through the steps to compute arima() and predict() so that I can implement an algorithm. If someone can point me to a sourcecode / psedocode / step-by-step example via data, it would really be helpful.

• Last time I went on the same cruise I found books on ARIMA rather than articles :) Commented May 2, 2013 at 22:57
• Well R is open source, so you already have some source code. Commented May 3, 2013 at 3:14

Here's an open source ARIMA implementation. It's under GNU license. Not sure if they would mind you learning from it!

It's an ARIMA implementation in C++, windows executable and source available. I think going through it you should be able to learn ARIMA the quick way.

• Welcome to CV. Would you mind giving a summary of what's there so readers can decide if it's what they're looking for, & / or in case of linkrot? Commented May 3, 2013 at 3:27
• I hope that is sufficient :) Commented May 3, 2013 at 3:54
• Thanks Rob, Farhan. If you have any suggestions on books for time series modeling for beginners, which also gives some background on basic concepts in statistics, that would be helpful. @gung - I'll need to cover quite some distance before I can give a decent summary of it. But I will try. Commented May 12, 2013 at 19:30
• @Mavadu, my comment was to Farhan, not you. Note that he did provide a summary of what's at the link, as I had asked. If you want to know some books for studying time series, you could read this thread: books-for-self-studying-time-series-analysis (which was easily discoverable by searching the site--you might find more useful info by searching & reading). Commented May 12, 2013 at 20:21
• @gung - Thanks I'll also make use of the link above! Commented May 12, 2013 at 22:31

If you're interested in fitting ARIMAs in Python then have a look at the statsmodels implementation. It already includes fitting, in-sample prediction, and forecasting methods. If you really want to write the function yourself then the source code might be useful, just as Farhan's C++ link could be for that language.

There is imo no better material for studying ARIMA models than the textbook "Time series analysis: forecasting and control" by Box, Jenkins, Reinsel, Ljung. Box and Jenkins are major contributors to the development of the ARIMA. Chapters on forecasting and parameter estimation include pretty detailed explanations of how to implement algorithms.