Repository: statsmodels/statsmodels

Issue:
BUG: incorrect HW predictions
Holt's model makes incorrect predictions for some types of inputs

```python
import pandas as pd
from statsmodels.tsa.holtwinters import Holt

# same inputs with two different types of freq (int and datetime)
array_input = [10, 20, 30, 40, 50]
pd_series_input = pd.Series([10, 20, 30, 40, 50], pd.date_range(start='1/1/2018', periods=5))

model_array = Holt(array_input).fit()
model_series = Holt(pd_series_input).fit()

print(model_array.predict()) # this model return 70
print(model_series.predict()) # this model return 60
```

Expected behavior that both models should return the same result.

I figured out the problem and fixed it in my [PR #7791](https://github.com/statsmodels/statsmodels/pull/7791).

statsmodels version: 0.13.0


Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/holtwinters/model.py b/statsmodels/tsa/holtwinters/model.py
--- a/statsmodels/tsa/holtwinters/model.py
+++ b/statsmodels/tsa/holtwinters/model.py
@@ -496,7 +496,7 @@ def predict(self, params, start=None, end=None):
         if start is None:
             freq = getattr(self._index, "freq", 1)
             if isinstance(freq, int):
-                start = self._index.shape[0] + freq
+                start = self._index.shape[0]
             else:
                 start = self._index[-1] + freq
         start, end, out_of_sample, _ = self._get_prediction_index(


Test patch:
diff --git a/statsmodels/tsa/holtwinters/tests/test_holtwinters.py b/statsmodels/tsa/holtwinters/tests/test_holtwinters.py
--- a/statsmodels/tsa/holtwinters/tests/test_holtwinters.py
+++ b/statsmodels/tsa/holtwinters/tests/test_holtwinters.py
@@ -1025,6 +1025,38 @@ def test_damping_trend_zero():
     assert_allclose(pred1, pred2, atol=1e-10)
 
 
+def test_different_inputs():
+    array_input_add = [10, 20, 30, 40, 50]
+    series_index_add = pd.date_range(start="2000-1-1", periods=len(array_input_add))
+    series_input_add = pd.Series(array_input_add, series_index_add)
+
+    array_input_mul = [2, 4, 8, 16, 32]
+    series_index_mul = pd.date_range(start="2000-1-1", periods=len(array_input_mul))
+    series_input_mul = pd.Series(array_input_mul, series_index_mul)
+
+    fit1 = ExponentialSmoothing(array_input_add, trend="add").fit()
+    fit2 = ExponentialSmoothing(series_input_add, trend="add").fit()
+    fit3 = ExponentialSmoothing(array_input_mul, trend="mul").fit()
+    fit4 = ExponentialSmoothing(series_input_mul, trend="mul").fit()
+
+    assert_almost_equal(fit1.predict(),
+                        [60], 1)
+    assert_almost_equal(fit1.predict(start=5, end=7),
+                        [60, 70, 80], 1)
+    assert_almost_equal(fit2.predict(),
+                        [60], 1)
+    assert_almost_equal(fit2.predict(start="2000-1-6", end="2000-1-8"),
+                        [60, 70, 80], 1)
+    assert_almost_equal(fit3.predict(),
+                        [64], 1)
+    assert_almost_equal(fit3.predict(start=5, end=7),
+                        [64, 128, 256], 1)
+    assert_almost_equal(fit4.predict(),
+                        [64], 1)
+    assert_almost_equal(fit4.predict(start="2000-1-6", end="2000-1-8"),
+                        [64, 128, 256], 1)
+
+
 @pytest.fixture
 def austourists():
     # austourists dataset from fpp2 package