Repository: statsmodels/statsmodels

Issue:
REF: x13 change forecast_years to forecast_periods
see #2881 deleted PR branch recovered from pull request branches, rebased on master


Discussion:

[![Coverage Status](https://coveralls.io/builds/10022648/badge)](https://coveralls.io/builds/10022648)

Changes Unknown when pulling **971de3aef27af8d89312f46a37a1ebfe91869ffc on josef-pkt:x13_rename_period** into ** on statsmodels:master**.

Need **kwargs and depreication warning.
@jbrockmendel Want to deploy your deprecate_kwargs as an alternative to close this?
I think its fine to just go for it.  x13 requires a non-python install so i usually ignore it

Resolving patch:
diff --git a/statsmodels/tsa/x13.py b/statsmodels/tsa/x13.py
--- a/statsmodels/tsa/x13.py
+++ b/statsmodels/tsa/x13.py
@@ -7,6 +7,8 @@
 Many of the functions are called x12. However, they are also intended to work
 for x13. If this is not the case, it's a bug.
 """
+from statsmodels.compat.pandas import deprecate_kwarg
+
 import os
 import subprocess
 import tempfile
@@ -170,11 +172,11 @@ def _make_regression_options(trading, exog):
     return reg_spec
 
 
-def _make_forecast_options(forecast_years):
-    if forecast_years is None:
+def _make_forecast_options(forecast_periods):
+    if forecast_periods is None:
         return ""
     forecast_spec = "forecast{\n"
-    forecast_spec += "maxlead = ({0})\n}}\n".format(forecast_years)
+    forecast_spec += "maxlead = ({0})\n}}\n".format(forecast_periods)
     return forecast_spec
 
 
@@ -316,9 +318,10 @@ def pandas_to_series_spec(x):
     return series_spec
 
 
+@deprecate_kwarg('forecast_years', 'forecast_periods')
 def x13_arima_analysis(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
                        exog=None, log=None, outlier=True, trading=False,
-                       forecast_years=None, retspec=False,
+                       forecast_periods=None, retspec=False,
                        speconly=False, start=None, freq=None,
                        print_stdout=False, x12path=None, prefer_x13=True):
     """
@@ -356,8 +359,8 @@ def x13_arima_analysis(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
         Whether or not outliers are tested for and corrected, if detected.
     trading : bool
         Whether or not trading day effects are tested for.
-    forecast_years : int
-        Number of forecasts produced. The default is one year.
+    forecast_periods : int
+        Number of forecasts produced. The default is None.
     retspec : bool
         Whether to return the created specification file. Can be useful for
         debugging.
@@ -427,7 +430,7 @@ def x13_arima_analysis(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
     options = _make_automdl_options(maxorder, maxdiff, diff)
     spec += "automdl{{{0}}}\n".format(options)
     spec += _make_regression_options(trading, exog)
-    spec += _make_forecast_options(forecast_years)
+    spec += _make_forecast_options(forecast_periods)
     spec += "x11{ save=(d11 d12 d13) }"
     if speconly:
         return spec
@@ -485,9 +488,10 @@ def x13_arima_analysis(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
     return res
 
 
+@deprecate_kwarg('forecast_years', 'forecast_periods')
 def x13_arima_select_order(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
                            exog=None, log=None, outlier=True, trading=False,
-                           forecast_years=None,
+                           forecast_periods=None,
                            start=None, freq=None, print_stdout=False,
                            x12path=None, prefer_x13=True):
     """
@@ -525,8 +529,8 @@ def x13_arima_select_order(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
         Whether or not outliers are tested for and corrected, if detected.
     trading : bool
         Whether or not trading day effects are tested for.
-    forecast_years : int
-        Number of forecasts produced. The default is one year.
+    forecast_periods : int
+        Number of forecasts produced. The default is None.
     start : str, datetime
         Must be given if ``endog`` does not have date information in its index.
         Anything accepted by pandas.DatetimeIndex for the start value.
@@ -570,7 +574,7 @@ def x13_arima_select_order(endog, maxorder=(2, 1), maxdiff=(2, 1), diff=None,
     """
     results = x13_arima_analysis(endog, x12path=x12path, exog=exog, log=log,
                                  outlier=outlier, trading=trading,
-                                 forecast_years=forecast_years,
+                                 forecast_periods=forecast_periods,
                                  maxorder=maxorder, maxdiff=maxdiff, diff=diff,
                                  start=start, freq=freq, prefer_x13=prefer_x13)
     model = re.search("(?<=Final automatic model choice : ).*",


Test patch: