Created
May 20, 2018 06:10
-
-
Save abhijeetpanda12/e2d2c14744c84b368910842a4ecfe0f7 to your computer and use it in GitHub Desktop.
Error output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import statsmodels.api as sm | |
dta = sm.datasets.macrodata.load_pandas().data | |
dta.index = pd.PeriodIndex(start='1959Q1', end='2009Q3', freq='Q') | |
mod = sm.tsa.SARIMAX(dta['infl'], order=(0, 0, 0)) | |
res = mod.fit() | |
print(res.summary()) | |
/usr/local/lib/python3.6/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead. | |
from pandas.core import datetools | |
--------------------------------------------------------------------------- | |
ValueError Traceback (most recent call last) | |
<ipython-input-1-c42339ff65f8> in <module>() | |
5 dta.index = pd.PeriodIndex(start='1959Q1', end='2009Q3', freq='Q') | |
6 | |
----> 7 mod = sm.tsa.SARIMAX(dta['infl'], order=(0, 0, 0)) | |
8 res = mod.fit() | |
9 print(res.summary()) | |
/usr/local/lib/python3.6/site-packages/statsmodels/tsa/statespace/sarimax.py in __init__(self, endog, exog, order, seasonal_order, trend, measurement_error, time_varying_regression, mle_regression, simple_differencing, enforce_stationarity, enforce_invertibility, hamilton_representation, **kwargs) | |
508 # Initialize the statespace | |
509 super(SARIMAX, self).__init__( | |
--> 510 endog, exog=exog, k_states=k_states, k_posdef=k_posdef, **kwargs | |
511 ) | |
512 | |
/usr/local/lib/python3.6/site-packages/statsmodels/tsa/statespace/mlemodel.py in __init__(self, endog, k_states, exog, dates, freq, **kwargs) | |
95 | |
96 # Initialize the state-space representation | |
---> 97 self.initialize_statespace(**kwargs) | |
98 | |
99 def prepare_data(self): | |
/usr/local/lib/python3.6/site-packages/statsmodels/tsa/statespace/mlemodel.py in initialize_statespace(self, **kwargs) | |
128 | |
129 # Instantiate the state space object | |
--> 130 self.ssm = KalmanSmoother(endog.shape[0], self.k_states, **kwargs) | |
131 # Bind the data to the model | |
132 self.ssm.bind(endog) | |
/usr/local/lib/python3.6/site-packages/statsmodels/tsa/statespace/kalman_smoother.py in __init__(self, k_endog, k_states, k_posdef, results_class, **kwargs) | |
341 | |
342 super(KalmanSmoother, self).__init__( | |
--> 343 k_endog, k_states, k_posdef, results_class=results_class, **kwargs | |
344 ) | |
345 | |
/usr/local/lib/python3.6/site-packages/statsmodels/tsa/statespace/kalman_filter.py in __init__(self, k_endog, k_states, k_posdef, loglikelihood_burn, tolerance, results_class, **kwargs) | |
211 **kwargs): | |
212 super(KalmanFilter, self).__init__( | |
--> 213 k_endog, k_states, k_posdef, **kwargs | |
214 ) | |
215 | |
/usr/local/lib/python3.6/site-packages/statsmodels/tsa/statespace/representation.py in __init__(self, k_endog, k_states, k_posdef, initial_variance, nobs, dtype, design, obs_intercept, obs_cov, transition, state_intercept, selection, state_cov, **kwargs) | |
276 # Get dimensions from transition equation | |
277 if k_states < 1: | |
--> 278 raise ValueError('Number of states in statespace model must be a' | |
279 ' positive number.') | |
280 self.k_states = k_states | |
ValueError: Number of states in statespace model must be a positive number. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment