Repository: statsmodels/statsmodels (Python)

Issue:
BUG: remove_data faills if model has non-implemented attributes with cache
#### Describe the bug

If there is a non-implemented attribute in the model with cache, `remove_data` fails at `getattr` call in L2224 of model.py.
https://github.com/statsmodels/statsmodels/blob/main/statsmodels/base/model.py#L2224

#### Code Sample, a copy-pastable example if possible


```python
from statsmodels.regression.quantile_regression import QuantReg

X = np.array([[1, 0], [0, 1], [0, 2.1], [0, 3.1]], dtype=np.float64)
y = np.array([0, 1, 2, 3], dtype=np.float64)
res = QuantReg(y, X).fit(0.5)
res.remove_data()
```
<details>

**Note**: As you can see, there are many issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates.

**Note**: Please be sure you are using the latest released version of `statsmodels`, or a recent build of `main`. If your problem has been fixed in an unreleased version, you might be able to use `main` until a new release occurs. 

**Note**: If you are using a released version, have you verified that the bug exists in the main branch of this repository? It helps the limited resources if we know problems exist in the current main branch so that they do not need to check whether the code sample produces a bug in the next release.

</details>


If the issue has not been resolved, please file it in the issue tracker.

#### Expected Output

The code does not raise `NotImplementedError`

#### Output of ``import statsmodels.api as sm; sm.show_versions()``

<details>

INSTALLED VERSIONS
------------------
Python: 3.9.2.final.0
OS: Linux 5.4.0-74-generic #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

statsmodels
===========

Installed: v0.13.0.dev0+391.g3f6fa5599 (/home/mknz/dev/statsmodels/statsmodels)

Required Dependencies
=====================

cython: Not installed
numpy: 1.20.3 (/home/mknz/dev/statsmodels/env/lib/python3.9/site-packages/numpy)
scipy: 1.6.3 (/home/mknz/dev/statsmodels/env/lib/python3.9/site-packages/scipy)
pandas: 1.2.4 (/home/mknz/dev/statsmodels/env/lib/python3.9/site-packages/pandas)
    dateutil: 2.8.1 (/home/mknz/dev/statsmodels/env/lib/python3.9/site-packages/dateutil)
patsy: 0.5.1 (/home/mknz/dev/statsmodels/env/lib/python3.9/site-packages/patsy)

Optional Dependencies
=====================

matplotlib: 3.4.2 (/home/mknz/.pyenv/versions/3.9.2/lib/python3.9/site-packages/matplotlib)
    backend: TkAgg
cvxopt: Not installed
joblib: 1.0.1 (/home/mknz/.pyenv/versions/3.9.2/lib/python3.9/site-packages/joblib)

Developer Tools
================

IPython: 7.23.1 (/home/mknz/.pyenv/versions/3.9.2/lib/python3.9/site-packages/IPython)
    jinja2: 3.0.0 (/home/mknz/.pyenv/versions/3.9.2/lib/python3.9/site-packages/jinja2)
sphinx: Not installed
    pygments: 2.9.0 (/home/mknz/.pyenv/versions/3.9.2/lib/python3.9/site-packages/pygments)
pytest: 6.2.4 (/home/mknz/dev/statsmodels/env/lib/python3.9/site-packages/pytest)
virtualenv: 20.4.6 (/home/mknz/.pyenv/versions/3.9.2/lib/python3.9/site-packages/virtualenv)


</details>



Hints:

Patch:
diff --git a/statsmodels/base/model.py b/statsmodels/base/model.py
--- a/statsmodels/base/model.py
+++ b/statsmodels/base/model.py
@@ -2216,12 +2216,6 @@ def remove_data(self):
                 cls_attrs[name] = attr
         data_attrs = [x for x in cls_attrs
                       if isinstance(cls_attrs[x], cached_data)]
-        value_attrs = [x for x in cls_attrs
-                       if isinstance(cls_attrs[x], cached_value)]
-        # make sure the cached for value_attrs are evaluated; this needs to
-        # occur _before_ any other attributes are removed.
-        for name in value_attrs:
-            getattr(self, name)
         for name in data_attrs:
             self._cache[name] = None
 
diff --git a/statsmodels/regression/rolling.py b/statsmodels/regression/rolling.py
--- a/statsmodels/regression/rolling.py
+++ b/statsmodels/regression/rolling.py
@@ -497,6 +497,7 @@ def __init__(
         self._cov_type = cov_type
         self._use_pandas = self.model.data.row_labels is not None
         self._data_attr = []
+        self._cache = {}
 
     def _wrap(self, val):
         """Wrap output as pandas Series or DataFrames as needed"""


Test patch:
diff --git a/statsmodels/regression/tests/test_quantile_regression.py b/statsmodels/regression/tests/test_quantile_regression.py
--- a/statsmodels/regression/tests/test_quantile_regression.py
+++ b/statsmodels/regression/tests/test_quantile_regression.py
@@ -281,3 +281,11 @@ def test_alpha_summary():
     summ_20 = res.summary(alpha=.2)
     assert '[0.025      0.975]' not in str(summ_20)
     assert '[0.1        0.9]' in str(summ_20)
+
+
+def test_remove_data():
+    X = np.array([[1, 0], [0, 1], [0, 2.1], [0, 3.1]], dtype=np.float64)
+    y = np.array([0, 1, 2, 3], dtype=np.float64)
+
+    res = QuantReg(y, X).fit(0.5)
+    res.remove_data()