internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: statsmodels/statsmodels

Issue:
BUG: allow Categorical endog for multinomial
#2013 raises an exception for object endog, but MNLogit can handle categorical endog.

Similar, OrderedModel in #2600 should be able to use pandas ordered Categorical

The binary models, Logit, Probit and GLM Binomial currently only handle numerical endog (in interval [0,1] in discrete)



Discussion:

Resolving patch:
diff --git a/statsmodels/discrete/discrete_model.py b/statsmodels/discrete/discrete_model.py
--- a/statsmodels/discrete/discrete_model.py
+++ b/statsmodels/discrete/discrete_model.py
@@ -2149,9 +2149,9 @@ class MNLogit(MultinomialModel):
     ----------
     endog : array_like
         `endog` is an 1-d vector of the endogenous response.  `endog` can
-        contain strings, ints, or floats.  Note that if it contains strings,
-        every distinct string will be a category.  No stripping of whitespace
-        is done.
+        contain strings, ints, or floats or may be a pandas Categorical Series.
+        Note that if it contains strings, every distinct string will be a
+        category.  No stripping of whitespace is done.
     exog : array_like
         A nobs x k array where `nobs` is the number of observations and `k`
         is the number of regressors. An intercept is not included by default


Test patch:
diff --git a/statsmodels/discrete/tests/test_discrete.py b/statsmodels/discrete/tests/test_discrete.py
--- a/statsmodels/discrete/tests/test_discrete.py
+++ b/statsmodels/discrete/tests/test_discrete.py
@@ -1554,6 +1554,18 @@ def test_mnlogit_factor():
     assert_allclose(predicted_f, predicted, rtol=1e-10)
 
 
+def test_mnlogit_factor_categorical():
+    dta = sm.datasets.anes96.load_pandas()
+    dta['endog'] = dta.endog.replace(dict(zip(range(7), 'ABCDEFG')))
+    exog = sm.add_constant(dta.exog, prepend=True)
+    mod = sm.MNLogit(dta.endog, exog)
+    res = mod.fit(disp=0)
+    dta['endog'] = dta['endog'].astype('category')
+    mod = sm.MNLogit(dta.endog, exog)
+    res_cat = mod.fit(disp=0)
+    assert_allclose(res.params, res_cat.params)
+
+
 def test_formula_missing_exposure():
     # see 2083
     d = {'Foo': [1, 2, 10, 149], 'Bar': [1, 2, 3, np.nan],
Repository: statsmodels/statsmodels

Issue:
BUG: ARMA better start_params, fix MA - rebased
this is a rebased version of #2594

I still get 3 failing unit tests when running this locally.

Even though the minlag requirement is correct, according to the references, it might cause different cases to fail, even though it might/will work better in general.

Also, I think we might want to automatically switch to some constant start_params if stationarity or invertibility condition fails in HR


Discussion:

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
@@ -544,7 +544,9 @@ def _fit_start_params_hr(self, order, start_ar_lags=None):
                 coefs = OLS(endog[max(p_tmp + q, p):], X).fit().params
                 start_params[k:k + p + q] = coefs
             else:
-                start_params[k + p:k + p + q] = yule_walker(endog, order=q)[0]
+                ar_coeffs = yule_walker(endog, order=q)[0]
+                ar = np.r_[[1], -ar_coeffs.squeeze()]
+                start_params[k + p:k + p + q] = arma2ma(ar, [1], nobs=q+1)[1:]
         if q == 0 and p != 0:
             arcoefs = yule_walker(endog, order=p)[0]
             start_params[k:k + p] = arcoefs


Test patch:
Repository: statsmodels/statsmodels

Issue:
Can't bundle using pyinstaller because of the "test" function in the "__init__.py".
Currently when I try to use pyinstaller to bundle a project which has a statsmodels dependency I get an error about "from ._version import get_versions" because of the other import statement in api.py "from .\_\_init\_\_ import test", pyinstaller adds two entries to it's toc file (a registry of required files) as below. And because of this duplication relative ._version import in \_\_init\_\_.py tries to import from "statsmodels.\_\_init\_\_._version" instead of "statsmodels._version".

Entries from Analysis.toc file:
```
('statsmodels.__init__',
   'c:\\program files\\python37\\lib\\site-packages\\statsmodels\\__init__.py',
('statsmodels',
   'c:\\program files\\python37\\lib\\site-packages\\statsmodels\\__init__.py',
```

Either refactoring the test function out of \_\_init\_\_.py or turning ._version relative import into an absolute import like so "statsmodels._version" seem to solve the issue.


Discussion:
Happy to accept a PR on this.  We don't test using pyinstaller. 

Resolving patch:
diff --git a/statsmodels/__init__.py b/statsmodels/__init__.py
--- a/statsmodels/__init__.py
+++ b/statsmodels/__init__.py
@@ -1,5 +1,5 @@
 
-from ._version import get_versions
+from statsmodels._version import get_versions
 
 debug_warnings = False
 


Test patch:
Repository: statsmodels/statsmodels

Issue:
The formula api method does not accept a valid EvalEnvironment
The `eval_env` parameter of the `model.from_formula` method cannot deal with a `patsy.EvalEnvironment`. According to the documentation, an environment is allowed.

**Code**

```python
import patsy
import pandas as pd
import statsmodels.formula.api as smf

df = pd.DataFrame({'x': [1, 2, 3], 'y': [2, 4, 6]})
env = patsy.eval.EvalEnvironment({})
model = smf.ols('y ~ x', eval_env=env, data=df)
```
**Result**

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-160a24b60e8a> in <module>
      6 env = patsy.eval.EvalEnvironment({})
----> 7 model = smf.ols('y ~ x', eval_env=env, data=df)

~/scm/python/statsmodels/statsmodels/base/model.py in from_formula(cls, formula, data, subset, drop_cols, *args, **kwargs)
    161             eval_env = EvalEnvironment({})
    162         else:
--> 163             eval_env += 1  # we're going down the stack again
    164         missing = kwargs.get('missing', 'drop')
    165         if missing == 'none':  # with patsy it's drop or raise. let's raise.

TypeError: unsupported operand type(s) for +=: 'EvalEnvironment' and 'int'
```


Discussion:

Resolving patch:
diff --git a/statsmodels/base/model.py b/statsmodels/base/model.py
--- a/statsmodels/base/model.py
+++ b/statsmodels/base/model.py
@@ -159,7 +159,7 @@ def from_formula(cls, formula, data, subset=None, drop_cols=None,
         elif eval_env == -1:
             from patsy import EvalEnvironment
             eval_env = EvalEnvironment({})
-        else:
+        elif isinstance(eval_env, int):
             eval_env += 1  # we're going down the stack again
         missing = kwargs.get('missing', 'drop')
         if missing == 'none':  # with patsy it's drop or raise. let's raise.


Test patch:
diff --git a/statsmodels/formula/tests/test_formula.py b/statsmodels/formula/tests/test_formula.py
--- a/statsmodels/formula/tests/test_formula.py
+++ b/statsmodels/formula/tests/test_formula.py
@@ -225,3 +225,12 @@ def test_predict_nondataframe():
     error = patsy.PatsyError
     with pytest.raises(error):
         fit.predict([0.25])
+
+
+def test_formula_environment():
+    df = pd.DataFrame({'x': [1, 2, 3], 'y': [2, 4, 6]})
+    env = patsy.EvalEnvironment([{'z': [3, 6, 9]}])
+    model = ols('y ~ x + z', eval_env=env, data=df)
+    assert 'z' in model.exog_names
+    with pytest.raises(TypeError):
+        ols('y ~ x', eval_env='env', data=df)
Repository: statsmodels/statsmodels

Issue:
[DOC] null model and ICC in mixed linear model
Could you guys consider adding some details for how to specify a null model and compute ICC? 
https://www.statsmodels.org/devel/examples/notebooks/generated/mixed_lm_example.html


Discussion:
btw, I think the "Likelihood" in the results summary should be "log-Likelihood", right? Is this intentioned?

![image](https://user-images.githubusercontent.com/33796896/67459909-a8e08080-f607-11e9-82d6-ec0734aca0d8.png)

Yes, `self.llf` is loglikelihood according to the [source code](
https://github.com/statsmodels/statsmodels/blob/5f33aab465f2345483c9d100af58d9f0f8d66504/statsmodels/regression/mixed_linear_model.py#L2508)

Resolving patch:
diff --git a/statsmodels/regression/mixed_linear_model.py b/statsmodels/regression/mixed_linear_model.py
--- a/statsmodels/regression/mixed_linear_model.py
+++ b/statsmodels/regression/mixed_linear_model.py
@@ -2604,7 +2604,7 @@ def summary(self, yname=None, xname_fe=None, xname_re=None,
         info["Dependent Variable:"] = yname
         info["Method:"] = self.method
         info["Scale:"] = self.scale
-        info["Likelihood:"] = self.llf
+        info["Log-Likelihood:"] = self.llf
         info["Converged:"] = "Yes" if self.converged else "No"
         smry.add_dict(info)
         smry.add_title("Mixed Linear Model Regression Results")


Test patch:
Repository: statsmodels/statsmodels

Issue:
BUG: Dynamic factor starting parameters computation fails if NaNs exist
#### Describe the bug

The problem is that `DynamicFactor` itself can handle missing values in `endog`, but `start_params` cannot.

#### Code Sample, a copy-pastable example if possible


```python
import statsmodels.api as sm

dta = sm.datasets.macrodata.load_pandas().data
endog1 = dta[['cpi', 'realint']]
mod = sm.tsa.DynamicFactor(endog1, k_factors=1, factor_order=1)
print(mod.start_params)

endog2 = dta[['cpi', 'realint']].copy()
endog2.iloc[4, :] = np.nan
mod = sm.tsa.DynamicFactor(endog2, k_factors=1, factor_order=1)
print(mod.start_params)
```

yields

```python
[ 624.6127141    27.2029389  3732.25387731    6.90035198    0.77157448]

---------------------------------------------------------------------------
MissingDataError                          Traceback (most recent call last)
<ipython-input-15-f70718facc54> in <module>
      9 endog2.iloc[4, :] = np.nan
     10 mod = sm.tsa.DynamicFactor(endog2, k_factors=1, factor_order=1)
---> 11 print(mod.start_params)

~/projects/statsmodels/statsmodels/tsa/statespace/dynamic_factor.py in start_params(self)
    451             # Use principal components + OLS as starting values
    452             res_pca = PCA(endog, ncomp=self.k_factors)
--> 453             mod_ols = OLS(endog, res_pca.factors)
    454             res_ols = mod_ols.fit()

...

MissingDataError: exog contains inf or nans
```


Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/statespace/dynamic_factor.py b/statsmodels/tsa/statespace/dynamic_factor.py
--- a/statsmodels/tsa/statespace/dynamic_factor.py
+++ b/statsmodels/tsa/statespace/dynamic_factor.py
@@ -445,6 +445,8 @@ def start_params(self):
         params = np.zeros(self.k_params, dtype=np.float64)
 
         endog = self.endog.copy()
+        mask = ~np.any(np.isnan(endog), axis=1)
+        endog = endog[mask]
 
         # 1. Factor loadings (estimated via PCA)
         if self.k_factors > 0:


Test patch:
diff --git a/statsmodels/tsa/statespace/tests/test_dynamic_factor.py b/statsmodels/tsa/statespace/tests/test_dynamic_factor.py
--- a/statsmodels/tsa/statespace/tests/test_dynamic_factor.py
+++ b/statsmodels/tsa/statespace/tests/test_dynamic_factor.py
@@ -972,3 +972,18 @@ def test_apply_results():
 
     assert_allclose(res3.forecast(10, exog=np.ones(10)),
                     res1.forecast(10, exog=np.ones(10)))
+
+
+def test_start_params_nans():
+    ix = pd.date_range('1960-01-01', '1982-10-01', freq='QS')
+    dta = np.log(pd.DataFrame(
+        results_varmax.lutkepohl_data, columns=['inv', 'inc', 'consump'],
+        index=ix)).diff().iloc[1:]
+
+    endog1 = dta.iloc[:-1]
+    mod1 = dynamic_factor.DynamicFactor(endog1, k_factors=1, factor_order=1)
+    endog2 = dta.copy()
+    endog2.iloc[-1:] = np.nan
+    mod2 = dynamic_factor.DynamicFactor(endog2, k_factors=1, factor_order=1)
+
+    assert_allclose(mod2.start_params, mod1.start_params)
Repository: statsmodels/statsmodels

Issue:
DOC/BUG: empty plot before correct plot in notebooks
It looks like the example notebook creation has an extra empty plot

example http://www.statsmodels.org/dev/examples/notebooks/generated/regression_diagnostics.html#Influence-tests

my guess is that it is because we assign to `fig` twice and jupyter might take this as a signal to create plots. (but see next case)
possible solution in analogy to the duplicate plot handling might be to put a comma at the end of the first line. e.g. `fig, ax = plt.subplots(figsize=(8,6)),`

maybe it's specific to that plot `sm.graphics.plot_leverage_resid2`
http://www.statsmodels.org/dev/examples/notebooks/generated/regression_plots.html#Leverage-Resid2-Plot
other plots also have two `fig` assignments but no extra plot.



Discussion:

Resolving patch:
diff --git a/statsmodels/graphics/regressionplots.py b/statsmodels/graphics/regressionplots.py
--- a/statsmodels/graphics/regressionplots.py
+++ b/statsmodels/graphics/regressionplots.py
@@ -955,9 +955,8 @@ def _plot_leverage_resid2(results, influence, alpha=.05, ax=None,
 def plot_leverage_resid2(results, alpha=.05, ax=None, **kwargs):
 
     infl = results.get_influence()
-    res = _plot_leverage_resid2(results, infl, alpha=.05, ax=None,
-                                **kwargs)
-    return res
+    return _plot_leverage_resid2(results, infl, alpha=alpha, ax=ax, **kwargs)
+
 
 
 @Appender(_plot_added_variable_doc % {


Test patch:
Repository: statsmodels/statsmodels

Issue:
BUG/ENH: empty hypothesis tests, VAR granger causality
it looks like VAR granger causality test has problems if the number of lags is zero
https://stackoverflow.com/questions/59014317/granger-causality-test-returning-value-error
(my guess based on the traceback)

check corner case behavior in VAR when no lags are used, i.e. regression on constant, trend or exog only.
I never checked what the behavior is in this case.

granger causality could raise an exception if there is nothing to test.
There might be other models with cases of automatically generated tests that could be empty.


Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/vector_ar/var_model.py b/statsmodels/tsa/vector_ar/var_model.py
--- a/statsmodels/tsa/vector_ar/var_model.py
+++ b/statsmodels/tsa/vector_ar/var_model.py
@@ -1800,6 +1800,9 @@ def test_causality(self, caused, causing=None, kind='f', signif=0.05):
             causing = [self.names[c] for c in caused_ind]
 
         k, p = self.neqs, self.k_ar
+        if p == 0:
+            err = "Cannot test Granger Causality in a model with 0 lags."
+            raise RuntimeError(err)
 
         # number of restrictions
         num_restr = len(causing) * len(caused) * p


Test patch:
diff --git a/statsmodels/tsa/vector_ar/tests/test_var.py b/statsmodels/tsa/vector_ar/tests/test_var.py
--- a/statsmodels/tsa/vector_ar/tests/test_var.py
+++ b/statsmodels/tsa/vector_ar/tests/test_var.py
@@ -378,6 +378,11 @@ def test_causality(self):
         with pytest.raises(Exception):
             self.res.test_causality(0, 1, kind='foo')
 
+    def test_causality_no_lags(self):
+        res = VAR(self.data).fit(maxlags=0)
+        with pytest.raises(RuntimeError, match="0 lags"):
+            res.test_causality(0, 1)
+
     @pytest.mark.smoke
     def test_select_order(self):
         result = self.model.fit(10, ic='aic', verbose=True)
Repository: statsmodels/statsmodels

Issue:
nonparametric.KDEUnivariate returns zero bandwidth
Hi,
Does anyone have an idea why the following dataset makes KDEUnivariate return zero bandwidth?

```
data = np.array([1,1,1,1,2])
kde_sm = sm.nonparametric.KDEUnivariate(data.astype('double'))
kde_sm.fit(bw="silverman")
sup = kde_sm.support
den = kde_sm.density
print(kde_sm.bw) # prints 0
```
when `data = np.array([1,1,1,2])` the returned bandwidth is correct. When I add more 1s, the bandwidth stays zero.

Thank you!


Discussion:

Resolving patch:
diff --git a/statsmodels/nonparametric/bandwidths.py b/statsmodels/nonparametric/bandwidths.py
--- a/statsmodels/nonparametric/bandwidths.py
+++ b/statsmodels/nonparametric/bandwidths.py
@@ -168,8 +168,10 @@ def select_bandwidth(x, bw, kernel):
     bw = bw.lower()
     if bw not in bandwidth_funcs:
         raise ValueError("Bandwidth %s not understood" % bw)
-#TODO: uncomment checks when we have non-rule of thumb bandwidths for diff. kernels
-#    if kernel == "gauss":
-    return bandwidth_funcs[bw](x, kernel)
-#    else:
-#        raise ValueError("Only Gaussian Kernels are currently supported")
+    bandwidth = bandwidth_funcs[bw](x, kernel)
+    if bandwidth == 0:
+        # eventually this can fall back on another selection criterion.
+        err = "Selected KDE bandwidth is 0. Cannot estiamte density."
+        raise RuntimeError(err)
+    else:
+        return bandwidth


Test patch:
diff --git a/statsmodels/nonparametric/tests/test_kernel_density.py b/statsmodels/nonparametric/tests/test_kernel_density.py
--- a/statsmodels/nonparametric/tests/test_kernel_density.py
+++ b/statsmodels/nonparametric/tests/test_kernel_density.py
@@ -114,6 +114,11 @@ def test_weighted_pdf_non_fft(self):
         npt.assert_allclose(kde_vals0, kde_expected,
                             atol=1e-6)
 
+    def test_all_samples_same_location_bw(self):
+        x = np.ones(100)
+        kde = nparam.KDEUnivariate(x)
+        with pytest.raises(RuntimeError, match="Selected KDE bandwidth is 0"):
+            kde.fit()
 
 
 class TestKDEMultivariate(KDETestBase):
Repository: statsmodels/statsmodels

Issue:
grangercausalitytests hangs
I'm calculating Granger Causality for several time series; on a subset of those time series the function (statsmodels.tsa.stattools.grangercausalitytests) hangs. In many of these situations, SIGALRM is ignored, and even interrupting the script itself (CTRL^C) is ineffective as well.

I've attached an example (erroneous) matrix, along with a script to load the matrix and call grangercausalitytests (It's actually a tar.bz file, not a PNG file). I'm using statsmodels 0.6.1

![granger-error tar bz](https://cloud.githubusercontent.com/assets/6140840/6863175/19d56256-d466-11e4-8b29-715fbe8a2548.png)



Discussion:
check if you have nans or inf in your data.

What operating system and which numpy version do you use?

There is no missing value handling in grangercausality tests and in some LAPACK version the svd can hang.

Thanks! Removing the NaN's and INF's did the trick.

I'm using numpy 1.8.2 and Ubuntu 14.04.2 LTS


Resolving patch:
diff --git a/statsmodels/tsa/stattools.py b/statsmodels/tsa/stattools.py
--- a/statsmodels/tsa/stattools.py
+++ b/statsmodels/tsa/stattools.py
@@ -1127,7 +1127,8 @@ def grangercausalitytests(x, maxlag, addconst=True, verbose=True):
     ----------
     x : array_like
         The data for test whether the time series in the second column Granger
-        causes the time series in the first column.
+        causes the time series in the first column. Missing values are not
+        supported.
     maxlag : {int, Iterable[int]}
         If an integer, computes the test for all lags up to maxlag. If an
         iterable, computes the tests only for the lags in maxlag.
@@ -1185,6 +1186,8 @@ def grangercausalitytests(x, maxlag, addconst=True, verbose=True):
     >>> gc_res = grangercausalitytests(data, [4])
     """
     x = array_like(x, 'x', ndim=2)
+    if not np.isfinite(x).all():
+        raise ValueError('x contains NaN or inf values.')
     addconst = bool_like(addconst, 'addconst')
     verbose = bool_like(verbose, 'verbose')
     try:


Test patch:
diff --git a/statsmodels/tsa/tests/test_stattools.py b/statsmodels/tsa/tests/test_stattools.py
--- a/statsmodels/tsa/tests/test_stattools.py
+++ b/statsmodels/tsa/tests/test_stattools.py
@@ -463,9 +463,17 @@ def test_grangercausality_single(self):
 
     def test_granger_fails_on_nobs_check(self, reset_randomstate):
         # Test that if maxlag is too large, Granger Test raises a clear error.
-        X = np.random.rand(10, 2)
-        grangercausalitytests(X, 2, verbose=False)  # This should pass.
-        assert_raises(ValueError, grangercausalitytests, X, 3, verbose=False)
+        x = np.random.rand(10, 2)
+        grangercausalitytests(x, 2, verbose=False)  # This should pass.
+        with pytest.raises(ValueError):
+            grangercausalitytests(x, 3, verbose=False)
+
+    def test_granger_fails_on_finite_check(self, reset_randomstate):
+        x = np.random.rand(1000, 2)
+        x[500, 0] = np.nan
+        x[750, 1] = np.inf
+        with pytest.raises(ValueError, match="x contains NaN"):
+            grangercausalitytests(x, 2)
 
 
 class SetupKPSS(object):
Repository: statsmodels/statsmodels

Issue:
[DOC] GLMGam alpha
`GLMGam.__init__`

>     alpha : list of floats
>         Penalization weights for smooth terms. The length of the list needs
>         to be the same as the number of smooth terms in the ``smoother``

I think it's either a list of floats, or a float in which case it's 'repeated' to the same len as the number of smooth terms


Discussion:

Resolving patch:
diff --git a/statsmodels/gam/generalized_additive_model.py b/statsmodels/gam/generalized_additive_model.py
--- a/statsmodels/gam/generalized_additive_model.py
+++ b/statsmodels/gam/generalized_additive_model.py
@@ -486,9 +486,9 @@ class GLMGam(PenalizedMixin, GLM):
         case is a partial linear model.
     smoother : instance of additive smoother class
         Examples of smoother instances include Bsplines or CyclicCubicSplines.
-    alpha : list of floats
+    alpha : float or list of floats
         Penalization weights for smooth terms. The length of the list needs
-        to be the same as the number of smooth terms in the ``smoother``
+        to be the same as the number of smooth terms in the ``smoother``.
     family : instance of GLM family
         See GLM.
     offset : None or array_like


Test patch:
Repository: statsmodels/statsmodels

Issue:
BUG: state space: integer params can cause imaginary output
In some cases, if integer parameters are passed to state-space models they may not get coerced to floats, depending on how the `update` method is structured. This can cause problems with output dtype, for example:

```python
mod = sarimax.SARIMAX([1, 1, 1], order=(1, 0, 0), exog=[2, 2, 2],
                      concentrate_scale=True)
res = mod.filter([1, 0])
print(res.predict(end=5, dynamic=True, exog=[3, 3, 4]))
```

yields

```python
array([2.+0.j, 2.+0.j, 2.+0.j, 3.+0.j, 3.+0.j, 4.+0.j])
```


Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/statespace/mlemodel.py b/statsmodels/tsa/statespace/mlemodel.py
--- a/statsmodels/tsa/statespace/mlemodel.py
+++ b/statsmodels/tsa/statespace/mlemodel.py
@@ -1634,6 +1634,10 @@ def handle_params(self, params, transformed=True, includes_fixed=False,
                       return_jacobian=False):
         params = np.array(params, ndmin=1)
 
+        # Never want integer dtype, so convert to floats
+        if np.issubdtype(params.dtype, np.integer):
+            params = params.astype(np.float64)
+
         if not includes_fixed and self._has_fixed_params:
             k_params = len(self.param_names)
             new_params = np.zeros(k_params, dtype=params.dtype) * np.nan


Test patch:
diff --git a/statsmodels/tsa/statespace/tests/test_mlemodel.py b/statsmodels/tsa/statespace/tests/test_mlemodel.py
--- a/statsmodels/tsa/statespace/tests/test_mlemodel.py
+++ b/statsmodels/tsa/statespace/tests/test_mlemodel.py
@@ -1099,3 +1099,12 @@ def test_append_extend_apply_invalid():
     message = 'The indices for endog and exog are not aligned'
     with pytest.raises(ValueError, match=message):
         res2.extend(endog4, exog=not_cts)
+
+
+def test_integer_params():
+    # See GH#6335
+    mod = sarimax.SARIMAX([1, 1, 1], order=(1, 0, 0), exog=[2, 2, 2],
+                          concentrate_scale=True)
+    res = mod.filter([1, 0])
+    p = res.predict(end=5, dynamic=True, exog=[3, 3, 4])
+    assert_equal(p.dtype, np.float64)