Repository: statsmodels/statsmodels

Issue:
KPSS Interpolation warning 
#### Describe the bug

A warning is printed out when the function is recalled, but the message is misleading and doesn't lead to resolution.

#### Code Sample, a copy-pastable example if possible

```python
from statsmodels.tsa.stattools import kpss

kpss(df.Passengers, nlags=12)
```
<details>

In executing the code above I receive the following warning 

```
/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/statsmodels/tsa/stattools.py:1685: InterpolationWarning: p-value is smaller than the indicated p-value
  warn("p-value is smaller than the indicated p-value", InterpolationWarning)
```

However it is not clear how I can define a p-value the function will use to compare.

</details>

#### Expected Output

From the given message, I would expect a method or a property to set the p-value.

#### Output of ``import statsmodels.api as sm; sm.show_versions()``

<details>

INSTALLED VERSIONS
------------------
Python: 3.8.2.final.0
OS: Darwin 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8

statsmodels
===========

Installed: 0.11.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/statsmodels)

Required Dependencies
=====================

cython: Not installed
numpy: 1.18.3 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/numpy)
scipy: 1.4.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/scipy)
pandas: 1.0.3 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/pandas)
    dateutil: 2.8.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/dateutil)
patsy: 0.5.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/patsy)

Optional Dependencies
=====================

matplotlib: 3.2.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/matplotlib)
    backend: module://ipykernel.pylab.backend_inline 
cvxopt: Not installed
joblib: 0.14.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/joblib)

Developer Tools
================

IPython: 7.14.0 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/IPython)
    jinja2: 2.11.2 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/jinja2)
sphinx: Not installed
    pygments: 2.6.1 (/Users/andreamoro/.pyenv/versions/3.8.2/lib/python3.8/site-packages/pygments)
pytest: Not installed
virtualenv: Not installed

</details>



Discussion:
It is just a bad warning message.  It should say something like `The p-value of the test statistic is less than the minimum value in the table, and so id set the the smallest p-value in the table (.001)`  (I would need to check the .001.)

Resolving patch:
diff --git a/statsmodels/tsa/stattools.py b/statsmodels/tsa/stattools.py
--- a/statsmodels/tsa/stattools.py
+++ b/statsmodels/tsa/stattools.py
@@ -1681,10 +1681,14 @@ def kpss(x, regression='c', nlags=None, store=False):
     kpss_stat = eta / s_hat
     p_value = np.interp(kpss_stat, crit, pvals)
 
+    warn_msg = """\
+The test statistic is outside of the range of p-values available in the
+look-up table. The actual p-value is {direction} than the p-value returned.
+"""
     if p_value == pvals[-1]:
-        warn("p-value is smaller than the indicated p-value", InterpolationWarning)
+        warn(warn_msg.format(direction="smaller"), InterpolationWarning)
     elif p_value == pvals[0]:
-        warn("p-value is greater than the indicated p-value", InterpolationWarning)
+        warn(warn_msg.format(direction="greater"), InterpolationWarning)
 
     crit_dict = {'10%': crit[0], '5%': crit[1], '2.5%': crit[2], '1%': crit[3]}
 


Test patch:
diff --git a/statsmodels/tsa/statespace/tests/test_exact_diffuse_filtering.py b/statsmodels/tsa/statespace/tests/test_exact_diffuse_filtering.py
--- a/statsmodels/tsa/statespace/tests/test_exact_diffuse_filtering.py
+++ b/statsmodels/tsa/statespace/tests/test_exact_diffuse_filtering.py
@@ -40,6 +40,7 @@
 Author: Chad Fulton
 License: Simplified-BSD
 """
+from statsmodels.compat.platform import PLATFORM_WIN
 
 import numpy as np
 import pandas as pd
@@ -1011,15 +1012,17 @@ def test_nondiagonal_obs_cov(reset_randomstate):
     mod.ssm.filter_univariate = True
     res2 = mod.smooth([])
 
+    atol = 0.002 if PLATFORM_WIN else 1e-5
+    rtol = 0.002 if PLATFORM_WIN else 1e-6
     # Here we'll just test a few values
-    assert_allclose(res1.llf, res2.llf, rtol=1e-6, atol=1e-5)
+    assert_allclose(res1.llf, res2.llf, rtol=rtol, atol=atol)
     assert_allclose(res1.forecasts[0], res2.forecasts[0],
-                    rtol=1e-6, atol=1e-5)
+                    rtol=rtol, atol=atol)
     assert_allclose(res1.filtered_state, res2.filtered_state,
-                    rtol=1e-6, atol=1e-5)
+                    rtol=rtol, atol=atol)
     assert_allclose(res1.filtered_state_cov, res2.filtered_state_cov,
-                    rtol=1e-6, atol=1e-5)
+                    rtol=rtol, atol=atol)
     assert_allclose(res1.smoothed_state, res2.smoothed_state,
-                    rtol=1e-6, atol=1e-5)
+                    rtol=rtol, atol=atol)
     assert_allclose(res1.smoothed_state_cov, res2.smoothed_state_cov,
-                    rtol=1e-6, atol=1e-5)
+                    rtol=rtol, atol=atol)
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
@@ -482,12 +482,7 @@ def test_granger_fails_on_finite_check(self, reset_randomstate):
             grangercausalitytests(x, 2)
 
 
-class SetupKPSS(object):
-    data = macrodata.load_pandas()
-    x = data.data['realgdp'].values
-
-
-class TestKPSS(SetupKPSS):
+class TestKPSS:
     """
     R-code
     ------
@@ -498,6 +493,10 @@ class TestKPSS(SetupKPSS):
     In this context, x is the vector containing the
     macrodata['realgdp'] series.
     """
+    @classmethod
+    def setup(cls):
+        cls.data = macrodata.load_pandas()
+        cls.x = cls.data.data['realgdp'].values
 
     def test_fail_nonvector_input(self, reset_randomstate):
         # should be fine