Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataFrame with integer names not handled in ARIMA #1038

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

Comments

Projects
None yet
2 participants
@jseabold
Copy link
Member

commented Aug 12, 2013

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

This comment has been minimized.

Copy link
Member Author

commented Aug 12, 2013

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

This comment has been minimized.

Copy link
Member Author

commented Aug 12, 2013

Can you check that #1039 fixes your problems?

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

@debovis

This comment has been minimized.

Copy link

commented Aug 14, 2013

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

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

Merge pull request statsmodels#1039 from jseabold/fix-arima-int-name
BUG: Fix ARIMA bugs for small data and data with integer names. Closes statsmodels#1038.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.