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

AutoArima 0 mean (no intercept) with constant time series #572

Open
BaklazhenkoNikita opened this issue Feb 19, 2024 · 3 comments
Open

AutoArima 0 mean (no intercept) with constant time series #572

BaklazhenkoNikita opened this issue Feb 19, 2024 · 3 comments

Comments

@BaklazhenkoNikita
Copy link

BaklazhenkoNikita commented Feb 19, 2024

Describe the bug

When provided with a completely constant time series (0,0,0) ARMA is being created with no intercept. Hence, for all the constant time series we predict 0. Slight alteration of time series with epsilon on the other hand leads to (0,0,0) ARMA with mean intercept.

To Reproduce

import pandas as pd
from pmdarima import auto_arima
from IPython.display import display

#Testing the Arima predictions with constant time series (returns 0 predictions)
data = pd.Series([1]*20, index=pd.period_range(start='2024-01-01', periods=20, freq='D'))

auto_arima_model = auto_arima(data, error_action='ignore')

n_periods = 5 
forecast = auto_arima_model.predict(n_periods=n_periods)

display(auto_arima_model.summary())
print("Forecast for constant time series:", forecast)

#Testing the Arima predictions with constant time series and one altered value (returns Mean as predictions)
data_non_constant = pd.Series([1]*19 + [1.1], index=pd.period_range(start='2024-01-01', periods=20, freq='D'))

auto_arima_model_non_constant = auto_arima(data_non_constant, error_action='ignore')

n_periods = 5 
forecast = auto_arima_model_non_constant.predict(n_periods=n_periods)

display(auto_arima_model_non_constant.summary())
print("Forecast for almost constant time series:", forecast)

Versions

Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python 3.9.11 (main, Mar 17 2022, 06:00:02) 
[GCC 10.2.1 20210110]
pmdarima 1.8.4
NumPy 1.24.4
SciPy 1.11.4
Scikit-Learn 1.2.2
Statsmodels 0.14.1

Expected Behavior

Expect to have ARIMA prediction with a constant (with a mean)

Actual Behavior

Predicts future observations with 0

Additional Context

Error happens in line 443-460, if set with_intercept to True, then we predict with a Mean +- epsilon.
ARIMA_0_Constant
image

@shreyash-Pandey-Katni
Copy link

Hi Team, Shall I take up this issue?

@tgsmith61591
Copy link
Member

Please feel free @shreyash-Pandey-Katni, and thank you for offering. I've not had the time to look at this

@shreyash-Pandey-Katni
Copy link

Thank you, I will start working on it ASAP.

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

No branches or pull requests

3 participants