DataFrame with integer names not handled in ARIMA #1038

Closed
jseabold opened this Issue Aug 12, 2013 · 3 comments

Projects

None yet

2 participants

@jseabold
Member
from datetime import datetime
import pandas as pd
import statsmodels.api as sm

vals = [96.2, 98.3, 99.1, 95.5, 94.0, 87.1, 87.9, 86.7402777504474]

dr = pd.date_range(datetime.today(), periods=len(vals), freq='AS')
ts = pd.TimeSeries(vals, index=dr)
df = pd.DataFrame(ts)
model = sm.tsa.ARIMA(df,(2,0,2)).fit()

File "scripts/arima_forecast.py", line 85, in 
model = ARIMA(df,(2,0,2), freq='AS').fit()
File "/Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg/statsmodels/tsa/arima_model.py", line 806, in fit
self.exog_names)
File "/Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg/statsmodels/tsa/arima_model.py", line 312, in _make_arma_names
ar_lag_names = util.make_lag_names([data.ynames], k_ar, 0)
File "/Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg/statsmodels/tsa/vector_ar/util.py", line 63, in make_lag_names
lag_names.append('L'+str(i)+'.'+name)
TypeError: cannot concatenate 'str' and 'numpy.int64' objects

Reported in this comment by @debovis b9cc594#commitcomment-3840566

Not sure if this is a bug yet. I suspect it may be, but if you just pass in the TimeSeries there's a lag order error. Should be able to get initial estimates for a 2,2 model with 8 observations.

@jseabold
Member

The lag order 'bug' is due to the fact that the lag-order selection in AR for the start params is 6 and there's only 8 observations. Really not sure how much of a real use-case this is to warrant a fix, but I guess I'll throw in another check.

@jseabold
Member

Can you check that #1039 fixes your problems?

@jseabold jseabold closed this in 3c9f89f Aug 14, 2013
@debovis
debovis commented Aug 14, 2013

Everything looks good, thanks for the quick response and turnover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment