# ARMA Model fitting using statsmodels.tsa.ARMA()

Two questions.

1.) When I use the statsmodels.tsa.ARMA() module, I enter my parameters and fit a model as follows:

 model = sm.tsa.ARMA(data, (AR_lag, MA_lag)).fit()


Just wondering. Say I enter numbers like AR_lag = 30 and Ma_lag = 30, is there any way to STOP the code from calculating all the lags between 1 and 30? I.e. - can I just calculate lag 30? For a single column of data about 360 entries in length the above code is burning the fire out of my brand-new, fully loaded, 15" MacBook Pro... Another API, pydse, can solve my problem in 10-12 seconds whereas the above method literally takes about 30 minutes. I would use pydse, except it currently doesn't provide a confidence interval as part of its output - it's a pretty new API. Any ideas on how to use statsmodels to calculate a single, specific AR or MA lag?

2.) I'd like to specify a vector of important lags such as Ar_lag = [30, 60], and forget about the others? Similar to the first question, but sort of the next level. Is there any way to do that and still avoid the problem described in item 1?

I'm using:

 model.predict(Start_Date, End_Date, dynamic=False)


to do out-of-sample prediction.

To help you guys better understand my data I've attached a plot of the actual data. While the blue and red lines are actual data, the green line represents out-of-sample predictions based on an AR lag of 30. Ideally it would have AR lags of 30 and 60 and an MA lag of 1, but my computer can't handle it because of the way statsmodels runs it (or because I don't understand how to use statsmodels well).

• I do not use Python, so I cannot comment on speed of calculations. In R it is possible to fix ARIMA coefficients to zero, so it is probable that it is possible to do that in Python too. Another variant is to use SARIMA specification. Your series exhibit clear seasonal variation, SARIMA would make a lot of sense. – mpiktas Apr 2 '15 at 6:55
• Forgive my ignorance, but what is the difference between SARIMA and ARIMA? – aacealo Apr 2 '15 at 9:36
• Conceptually every SARIMA model is an ARIMA model, but SARIMA allows specification of ARIMA model without certain lags. For example you can specify the model $y_t=\mu+\phi_1y_{t-30}+\phi_2y_{t-60}+\varepsilon_t$, which is what you need based on your question. – mpiktas Apr 2 '15 at 12:22
• Thanks for the input. I still have some experimenting to do - I'm attempting to switch to R... - but I have not forgotten about this. The switch is not trivial, due to the learning involved. I will follow up once I have arrived at a solution. – aacealo Apr 8 '15 at 1:25