Repository: statsmodels/statsmodels

Issue:
arima summary ValueError: xnames and params do not have the same length
Hi, 

after fitting with
```
my_arima = sm.tsa.ARIMA(endog=y_train.values,exog=x_train,order=(0, 1, 0)).fit()
```

 `my_arima.summary()` gives

`ValueError: xnames and params do not have the same length`


I don't understand what's going on as I am not giving any `exog_names` 

Thanks for support.
ps: find attached the `y_train` -- for `x_train` you can use simply `np.arange(0,35)`

pps: thanks for the module...It's the first time I am using it (with ARIMA). It's nice that it covers many topics. However, would be nice to have a better documentation, given that many attributes, functions are still empty, or with very little documentation.

[y_train_arima.txt](https://github.com/statsmodels/statsmodels/files/2278225/y_train_arima.txt)


Discussion:
This might be a bug or feature (?) if there are no parameters to estimate.
I don't remember the details, but the `constant` will be one parameter in this model (which can be or is included in exog). We explicitly included the no lags case as reference model for model comparison. So this is more likely a bug, unless constant is also dropped (trend='nc').

SARIMAX and the statespace models have now better documentation than ARIMA, and are better maintained.
However, I don't know if that supports a "no-parameter" model.

Empty `params`, or no estimated `params` has an open issue, IIRC, that I don't find anymore. 
There is no generic support, e.g. in summary or similar for that case.
#3567 is the no estimated params issue
I see -- thanks @josef-pkt 

For the 'pps': do you always suggest to use SARIMAX instead? 
> do you always suggest to use SARIMAX instead?

In general yes. 
There might be a few cases where the availability of results or performance might differ.
However, SARIMAX is the more "modern" version, and ARIMA is largely in bug-fix mode. But, ARIMA has been around for a long time and also works well. 
There can be problems in optimization in "not nice" cases in either model, those cases are more likely to be fixed in SARIMAX.

Deprecation of ARIMA is discussed in #3884, but hasn't been decided yet, and even if/when ARIMA is deprecated it will stay in statsmodels for a longer time given its large historical user base.

Resolving patch:
diff --git a/statsmodels/tsa/arima_model.py b/statsmodels/tsa/arima_model.py
--- a/statsmodels/tsa/arima_model.py
+++ b/statsmodels/tsa/arima_model.py
@@ -385,17 +385,6 @@ def _make_arma_names(data, k_trend, order, exog_names):
     ma_lag_names = [''.join(('ma.', i)) for i in ma_lag_names]
     trend_name = util.make_lag_names('', 0, k_trend)
 
-    # ensure exog_names stays unchanged when the `fit` method
-    # is called multiple times.
-    if k_ma ==0 and k_ar ==0:
-        if len(exog_names) != 0:
-            return exog_names
-    elif (exog_names[-k_ma:] == ma_lag_names and
-          exog_names[-(k_ar+k_ma):-k_ma] == ar_lag_names and
-          (not exog_names or not trend_name
-           or trend_name[0] == exog_names[0])):
-        return exog_names
-
     exog_names = trend_name + exog_names + ar_lag_names + ma_lag_names
     return exog_names
 
@@ -447,6 +436,7 @@ def __init__(self, endog, order, exog=None, dates=None, freq=None,
         else:
             k_exog = 0
         self.k_exog = k_exog
+        self._orig_exog_names = self.exog_names
 
     def _fit_start_params_hr(self, order, start_ar_lags=None):
         """
@@ -926,8 +916,8 @@ def fit(self, start_params=None, trend='c', method="css-mle",
         self.exog = exog    # overwrites original exog from __init__
 
         # (re)set names for this model
-        self.exog_names = _make_arma_names(self.data, k_trend, (k_ar, k_ma),
-                                           self.exog_names)
+        self.exog_names = _make_arma_names(self.data, k_trend,
+                                           (k_ar, k_ma), self._orig_exog_names)
         k = k_trend + k_exog
 
         # choose objective function


Test patch:
diff --git a/statsmodels/tsa/tests/test_arima.py b/statsmodels/tsa/tests/test_arima.py
--- a/statsmodels/tsa/tests/test_arima.py
+++ b/statsmodels/tsa/tests/test_arima.py
@@ -2465,3 +2465,14 @@ def test_arima_no_full_output():
     mod = ARIMA(endog, (1, 0, 1))
     res = mod.fit(trend="c", disp=-1, full_output=False)
     assert res.mle_retvals is None
+
+
+def test_arima_summary_no_lags(reset_randomstate):
+    y_train = pd.Series(np.random.randn(1000), name='y_train')
+    x_train = pd.DataFrame(np.random.randn(1000, 2), columns=['x1', 'x2'])
+    res = ARIMA(endog=y_train.values, exog=x_train,
+                order=(0, 1, 0)).fit(disp=-1)
+    summ = res.summary().as_text()
+    assert 'const ' in summ
+    assert 'x1 ' in summ
+    assert 'x2 ' in summ