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
emplike/OLS convergence checks in conf_int_el and test_el #1216
OLSResults conf_int_el and test_el
don't have checks for successful convergence, rootfinding.
In a Debian test run the returned results is out of bounds
The test fails only on some machines.
Instead of returning wrong results we should try again for better convergence or raise an exception if a root cannot be found
statsmodels_0.5.0+git13-g8e07d34-1~nd13.04+1_i386.build FAILED 18:05.47 real, 671.50 user, 186.72 sys, 1147360 out
FAIL: statsmodels.emplike.tests.test_regression.TestRegressionNM.test_ci_beta2
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/tmp/buildd/statsmodels-0.5.0+git13-g8e07d34/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/emplike/tests/test_regression.py", line 149, in test_ci_beta2
assert_almost_equal(beta2ci, self.res2.test_ci_beta2, 6)
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 452, in assert_almost_equal
return assert_array_almost_equal(actual, desired, decimal, err_msg)
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 812, in assert_array_almost_equal
header=('Arrays are not almost equal to %d decimals' % decimal))
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 645, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 6 decimals
(mismatch 50.0%)
x: array([ 0.60120459, 0. ])
y: array([ 0.60120459, 2.18470794])
This might make it possible to speed up the conf_int_el search, if the parameters are further away from the unrestricted estimate.
This might only help if we trace the el_test values or calculate them on a grid, where we can use neighboring params. It won't help with brentq or similar because they don't do a sequential search, but might help close to the root of the conf_int search (when it searches more locally).
Sounds too complicated for the rootfinding because we would need to memoize, since we don't have direct access to what brentq is doing during search.
The root function looks monotonic when printing out some results for the root function in the neighborhood of the conf_int lower bound. (parameter number 2)
My guess is that we need to check the convergence of fmin_powell or fmin, and warn or raise if it didn't converge well enough.
@j-grana6 Do you have an example that always breaks in the convergence? It would be useful to have a case for testing when we don't have nice convergence.
another possibility to narrow down where the problem on the difficult machines is to add a unit test for el_test at the confidence bounds to test_ci_beta2
The root function looks monotonic when printing out some results for
the root function in the neighborhood of the conf_int lower bound.
(parameter number 2)
My guess is that we need to check the convergence of fmin_powell or
fmin, and warn or raise if it didn't converge well enough.
I just tried fiddling around and I don't. I'm a bit confused because I
also tried a simulated example with a very poorly specified model. I
thought maybe that was the cause for convergence issues but it actually
converged very quickly.
It would be useful to have a case for testing when we don't have nice
convergence.
—
Reply to this email directly or view it on GitHub #1216 (comment).
another possibility to narrow down where the problem on the difficult
machines is to add a unit test for el_test at the confidence bounds to
test_ci_beta2
I can do this. I even wrote in the documentation that users should do
this after computing a confience interval. maybe I just should build it
in as an extra assertion.
|>>> res1.el_test(0.60120509116947018, [2])
(3.8414512399018919, 0.05000022605567922)
Sorry this was for me to look into and I have been jammed lately. It
might be best to skip them for this release as I do not know when I will
be able to get to this. Josef, what do you think?
—
Reply to this email directly or view it on GitHub #1216 (comment).
Activity
josef-pkt commentedon Nov 30, 2013
also
upper_bound = self.conf_int(.01)[param_num][1]has hardcoded alpha 0.01I think this should be a fraction of
sigjosef-pkt commentedon Nov 30, 2013
el_testcould take a start_params forx0.This might make it possible to speed up the conf_int_el search, if the parameters are further away from the unrestricted estimate.
This might only help if we trace the el_test values or calculate them on a grid, where we can use neighboring params. It won't help with brentq or similar because they don't do a sequential search, but might help close to the root of the conf_int search (when it searches more locally).
Sounds too complicated for the rootfinding because we would need to memoize, since we don't have direct access to what brentq is doing during search.
It could still help in a grid search.
josef-pkt commentedon Nov 30, 2013
The root function looks monotonic when printing out some results for the root function in the neighborhood of the conf_int lower bound. (parameter number 2)
My guess is that we need to check the convergence of fmin_powell or fmin, and warn or raise if it didn't converge well enough.
@j-grana6 Do you have an example that always breaks in the convergence? It would be useful to have a case for testing when we don't have nice convergence.
josef-pkt commentedon Nov 30, 2013
another possibility to narrow down where the problem on the difficult machines is to add a unit test for el_test at the confidence bounds to test_ci_beta2
j-grana6 commentedon Nov 30, 2013
On 11/30/2013 02:03 PM, Josef Perktold wrote:
j-grana6 commentedon Nov 30, 2013
On 11/30/2013 02:14 PM, Josef Perktold wrote:
yarikoptic commentedon Jan 4, 2014
Hi guys -- any advice on my course of action to address tests failures on those exotic architectures?
https://buildd.debian.org/status/package.php?p=statsmodels
should they be skipped there or ... ?
j-grana6 commentedon Jan 4, 2014
On 01/04/2014 01:40 PM, Yaroslav Halchenko wrote:
jseabold commentedon Jan 4, 2014
Skipping them sounds fine to me. All we would do is change the tests to pass AFAIK. The code is "right."