You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unhandled 0 division in the denominator, line275 in robust_linear_model.py #5878
[A clear and concise description of what the bug is. This should explain why the current behaviour is a problem and why the expected output is a better solution.]
Code Sample, a copy-pastable example if possible
# Your code here that produces the bug# This example should be self-contained, and so not rely on external data.# It should run in a fresh ipython session, and so include all relevant imports.
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 master. If your problem has been fixed in an unreleased version, you might be able to use master until a new release occurs.
Note: If you are using a released version, have you verified that the bug exists in the master branch of this repository? It helps the limited resources if we know problems exist in the current master so that they do not need to check whether the code sample produces a bug in the next release.
If the issue has not been resolved, please file it in the issue tracker.
Expected Output
A clear and concise description of what you expected to happen.
Output of import statsmodels.api as sm; sm.show_versions()
Details
[paste the output of import statsmodels.api as sm; sm.show_versions() here below this line]
Describe the bug:
In robust_linear_model.py, there is unhandled zero division on line 275, I've noticed that if I pass in a DataFrame with perfect linear model fit with 0 residual, then the program hangs and never finishes.
See the following for my example DataFrame(['FCFSales', 'const']being endogenous, ['BNRMTE02] being exdogenous )
The program hangs with error message:
/NImounts/NiNoSnapDev/medusa_egg_cache/27-3/s/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/robust/robust_linear_model.py:284: RuntimeWarning: divide by zero encountered in divide
self.weights = self.M.weights(wls_results.resid/self.scale)
/NImounts/NiNoSnapDev/medusa_egg_cache/27-3/s/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/robust/norms.py:190: RuntimeWarning: invalid value encountered in less_equal
return np.less_equal(np.fabs(z), self.t)
Activity
jasonlocal commentedon Jun 21, 2019
Describe the bug:
In robust_linear_model.py, there is unhandled zero division on line 275, I've noticed that if I pass in a DataFrame with perfect linear model fit with 0 residual, then the program hangs and never finishes.
See the following for my example DataFrame(['FCFSales', 'const']being endogenous, ['BNRMTE02] being exdogenous )
The program hangs with error message:
/NImounts/NiNoSnapDev/medusa_egg_cache/27-3/s/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/robust/robust_linear_model.py:284: RuntimeWarning: divide by zero encountered in divide
self.weights = self.M.weights(wls_results.resid/self.scale)
/NImounts/NiNoSnapDev/medusa_egg_cache/27-3/s/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/robust/norms.py:190: RuntimeWarning: invalid value encountered in less_equal
return np.less_equal(np.fabs(z), self.t)
bashtage commentedon Jun 21, 2019
FWIW You can edit posts, so could you edit the first one and use the code block (which is demarcated with triple ticks)?
BUG/ENH: Improve RLM in the case of perfect fit
BUG/ENH: Improve RLM in the case of perfect fit
BUG/ENH: Improve RLM in the case of perfect fit