Skip to content

Commit b53ba1a

Browse files
authored
Merge pull request statsmodels#4559 from jbrockmendel/roots
REF: make arroots and maroots have consistent return type
2 parents c8841e8 + 2a4e723 commit b53ba1a

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

lint.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ if [ "$LINT" == true ]; then
1919
flake8 --isolated \
2020
statsmodels/resampling/ \
2121
statsmodels/interface/ \
22+
statsmodels/duration/__init__.py \
23+
statsmodels/graphics/tsaplots.py \
2224
statsmodels/graphics/functional.py \
2325
statsmodels/graphics/tests/test_functional.py \
2426
statsmodels/examples/tests/ \
2527
statsmodels/iolib/smpickle.py \
2628
statsmodels/iolib/tests/test_pickle.py \
27-
statsmodels/graphics/tsaplots.py \
28-
statsmodels/tsa/regime_switching \
2929
statsmodels/regression/mixed_linear_model.py \
30-
statsmodels/duration/__init__.py \
3130
statsmodels/regression/recursive_ls.py \
3231
statsmodels/tools/linalg.py \
3332
statsmodels/tools/web.py \
3433
statsmodels/tools/tests/test_linalg.py \
3534
statsmodels/tools/decorators.py \
3635
statsmodels/tools/tests/test_decorators.py \
3736
statsmodels/tsa/base/tests/test_datetools.py \
37+
statsmodels/tsa/regime_switching \
3838
statsmodels/tsa/vector_ar/dynamic.py \
3939
statsmodels/tsa/vector_ar/hypothesis_test_results.py \
4040
statsmodels/tsa/statespace/*.py \

statsmodels/tsa/arima_model.py

-4
Original file line numberDiff line numberDiff line change
@@ -1412,8 +1412,6 @@ def arfreq(self):
14121412
roots.
14131413
"""
14141414
z = self.arroots
1415-
if not z.size:
1416-
return
14171415
return np.arctan2(z.imag, z.real) / (2*pi)
14181416

14191417
@cache_readonly
@@ -1425,8 +1423,6 @@ def mafreq(self):
14251423
roots.
14261424
"""
14271425
z = self.maroots
1428-
if not z.size:
1429-
return
14301426
return np.arctan2(z.imag, z.real) / (2*pi)
14311427

14321428
@cache_readonly

statsmodels/tsa/tests/test_arima.py

+12
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,18 @@ def test_predictions(self):
19801980
predictions = self.arma_00_res.predict()
19811981
assert_almost_equal(self.y.mean() * np.ones_like(predictions), predictions)
19821982

1983+
def test_arroots(self):
1984+
# regression test; older implementation of arroots returned None
1985+
# instead of en empty array
1986+
roots = self.arma_00_res.arroots
1987+
assert_equal(roots.size, 0)
1988+
1989+
def test_maroots(self):
1990+
# regression test; older implementation of arroots returned None
1991+
# instead of en empty array
1992+
roots = self.arma_00_res.maroots
1993+
assert_equal(roots.size, 0)
1994+
19831995
@pytest.mark.skip
19841996
def test_information_criteria(self):
19851997
# This test is invalid since the ICs differ due to df_model differences

0 commit comments

Comments
 (0)