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

Errors #12

Open
trandafile opened this issue Jul 2, 2024 · 5 comments
Open

Errors #12

trandafile opened this issue Jul 2, 2024 · 5 comments

Comments

@trandafile
Copy link

I'm trying to use the code.

This section: from statsmodels.tsa.seasonal import seasonal_decompose

decomposition = seasonal_decompose(df_sample['SP500'], model='additive', freq=30)
plt.rcParams["figure.figsize"] = [13, 7]
fig = decomposition.plot()

Gives these errors:
TypeError Traceback (most recent call last)
Cell In[53], line 3
1 from statsmodels.tsa.seasonal import seasonal_decompose
----> 3 decomposition = seasonal_decompose(df_sample['SP500'], model='additive', freq=30)
4 plt.rcParams["figure.figsize"] = [13, 7]
5 fig = decomposition.plot()

TypeError: seasonal_decompose() got an unexpected keyword argument 'freq'

@snsten
Copy link
Owner

snsten commented Jul 7, 2024

What's the version of statsmodels package are you using?

@trandafile
Copy link
Author

trandafile commented Jul 8, 2024 via email

@snsten
Copy link
Owner

snsten commented Jul 14, 2024

I checked the docs for 0.14.2 and the keyword freq is changed to period.
So in the new version of library the code is:
decomposition = seasonal_decompose(df_sample['SP500'], model='additive', period=30)

@trandafile
Copy link
Author

Thanks a lot for your feedback. Now this section of the code is working. However, I get this error: ---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In[24], line 3
1 from statsmodels.tsa.arima_model import ARIMA
----> 3 model = ARIMA(df_sample.y_log, order=(1,1,2))
4 model_fit = model.fit(disp=0)
5 print(model_fit.summary())

File c:\Users\Luigi Boccia\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\tsa\arima_model.py:45, in ARIMA.init(self, *args, **kwargs)
44 def init(self, *args, **kwargs):
---> 45 super().init(*args, **kwargs)

File c:\Users\Luigi Boccia\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\tsa\arima_model.py:29, in ARMA.init(self, *args, **kwargs)
28 def init(self, *args, **kwargs):
---> 29 raise NotImplementedError(ARIMA_DEPRECATION_ERROR)

NotImplementedError:
statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have
been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the .
between arima and model) and statsmodels.tsa.SARIMAX.

statsmodels.tsa.arima.model.ARIMA makes use of the statespace framework and
is both well tested and maintained. It also offers alternative specialized
parameter estimators.

@trandafile
Copy link
Author

I've solved it using this code:

import pandas as pd
from statsmodels.tsa.arima.model import ARIMA
model = ARIMA(df_sample['y_log'], order=(1, 1, 2))
model_fit = model.fit()

print(model_fit.summary())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants