Repository navigation
Description
Describe the bug
Attempting to use missing='drop' with MixedLM results in an IndexError because the class does not properly drop missing rows from every input. Oddly, smf.mixedlm does handle missing data properly thanks to #3591.
Code Sample, a copy-pastable example if possible
# y is a pandas Series with some missing values
m = sm.MixedLM(y, X, groups=groups, missing='drop') # IndexError
m = smf.mixedlm('y ~ x', X.join(y), groups=groups, missing='drop') # this worksOutput of import statsmodels.api as sm; sm.show_versions()
Details
INSTALLED VERSIONS
Python: 3.9.9.final.0
OS: Linux 5.10.85-1-lts #1 SMP Tue, 14 Dec 2021 18:50:52 +0000 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
statsmodels
Installed: 0.13.1 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/statsmodels)
Required Dependencies
cython: Not installed
numpy: 1.21.4 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/numpy)
scipy: 1.7.3 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/scipy)
pandas: 1.3.5 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/pandas)
dateutil: 2.8.2 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/dateutil)
patsy: 0.5.2 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/patsy)
Optional Dependencies
matplotlib: 3.5.1 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/matplotlib)
backend: module://matplotlib_inline.backend_inline
cvxopt: Not installed
joblib: 1.1.0 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/joblib)
Developer Tools
IPython: 7.30.1 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/IPython)
jinja2: 3.0.3 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/jinja2)
sphinx: Not installed
pygments: 2.10.0 (/opt/mambaforge/envs/GeneStruct/lib/python3.9/site-packages/pygments)
pytest: Not installed
virtualenv: Not installed
Activity
BUG: Fix missing="drop" in MixedLM