-
Notifications
You must be signed in to change notification settings - Fork 57
ValueError: x contains a constant. Adding a constant with trend='c' is not allowed. #3
Copy link
Copy link
Open
Description
Hi,
I am getting the following error with this function:
df_out = interact.autoregression(df.copy()); df_out.head()
D:\Anaconda3\envs\tipjar\lib\site-packages\statsmodels\tsa\ar_model.py:691: FutureWarning:
statsmodels.tsa.AR has been deprecated in favor of statsmodels.tsa.AutoReg and
statsmodels.tsa.SARIMAX.
AutoReg adds the ability to specify exogenous variables, include time trends,
and add seasonal dummies. The AutoReg API differs from AR since the model is
treated as immutable, and so the entire specification including the lag
length must be specified when creating the model. This change is too
substantial to incorporate into the existing AR api. The function
ar_select_order performs lag length selection for AutoReg models.
AutoReg only estimates parameters using conditional MLE (OLS). Use SARIMAX to
estimate ARX and related models using full MLE via the Kalman Filter.
To silence this warning and continue using AR until it is removed, use:
import warnings
warnings.filterwarnings('ignore', 'statsmodels.tsa.ar_model.AR', FutureWarning)
warnings.warn(AR_DEPRECATION_WARN, FutureWarning)
Traceback (most recent call last):
File "D:\Anaconda3\envs\tipjar\lib\site-packages\IPython\core\interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-82-60579f16e2a8>", line 1, in <module>
df_out = dp.interact.autoregression(x.copy())
File "D:\Anaconda3\envs\tipjar\lib\site-packages\deltapy\interact.py", line 61, in autoregression
fitted_model = AR(df.values[i, :]).fit(autoreg_lag)
File "D:\Anaconda3\envs\tipjar\lib\site-packages\statsmodels\tsa\ar_model.py", line 1223, in fit
X = self._stackX(k_ar, trend) # sets self.k_trend
File "D:\Anaconda3\envs\tipjar\lib\site-packages\statsmodels\tsa\ar_model.py", line 1044, in _stackX
X = add_trend(X, prepend=True, trend=trend, has_constant="raise")
File "D:\Anaconda3\envs\tipjar\lib\site-packages\statsmodels\tsa\tsatools.py", line 121, in add_trend
raise ValueError(msg)
ValueError: x contains a constant. Adding a constant with trend='c' is not allowed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels