fvalue and mse_model are -inf if only 1 regressor
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
statsmodels |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
the tests for dimension of exog, endog for model fail because -if is not equal -inf.
The source I think is if exog is only 1d or one column, then the df_model = 0, which, I think, causes a zero division for fvalue and mse_model
It is necessary to fix test and to check whether the -inf result is actually correct.
I did the initial correction in the test for fvalue, but commented it out again, because we need to check first if -inf is correct.
In the example, the df_model should be 1 instead of 0.
I think we need a `hasconstant` indicator so we can use
the correct df if there is only 1 (non-constant) regressor.
If we correct df_model by not subtracting 1, then we won't get -inf in the
case of this ticket, and we can ignore that -inf != -inf with numpy <= 1.3
Changed in statsmodels: | |
status: | New → Confirmed |
description: | updated |
The test failures are with numpy 1.3., this has been changed in trunk projects. scipy.org/ numpy/changeset /7262/trunk/ numpy/testing
http://
allow inf-inf and nan-nan comparisons to be True in testing
below are the results of the test run, (the same failures are in trunk)
>add_statsmodel s-skipper_ path.py eclipsegworkspa ce\statsmodels- skipper\ scikits\ statsmodels\ __init_ _.pyc Python25\ lib\site- packages\ numpy K.S.... SS..... .S..... ...S... ....... ..S.... ....... .S..... ...SS.. ....S.. ..S S....SS. .....S. ....... S...... .KSS... ...S... KSS.... ..S.... SS..... .S..... .. ....... .F.F... ......
C:\Josef\
Running unit tests for numpy
NumPy version 1.3.0
NumPy is installed in C:\Programs\
Python version 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Int
el)]
nose version 0.11.1
....Warning message:
package 'MASS' was built under R version 2.7.2
.SS....
.......
.S.....
Attaching package: 'car'
The following object(s) are masked from package:Hmisc :
recode
Warning message: ....... ....... ....... ....... ....... ....... ....... ....... .F.F... ....... ... ....... ......F. F...... ....... ....... ....... ...S... ....... SS.S.S. .S..... .. ....... ....... ....... ....... ....... S....S. .S..... ....S.. ..S..S. ....... S.. S....S. .S..... ...S... ....... ....... ....... ....... ....... ....... ....... ... ======= ======= ======= ======= ======= ======= ======= ======= ======= .TestDataDimens ions.test_ fvalue ------- ------- ------- ------- ------- ------- ------- ------- ------- python25\ lib\site- packages\ nose-0. 11.1-py2. 5.egg\nose\ case.p test(*self. arg) eclipsegworkspa ce\statsmodels- skipper\ scikits\ statsmodels\ tests n.py", line 95, in test_fvalue almost_ equal(self. res1.fvalue, self.res2.fvalue, DECIMAL) Python25\ Lib\site- packages\ numpy\testing\ utils.py" , line 265
package 'car' was built under R version 2.7.2
.......
..F.F..
S......
.......
.......
=======
FAIL: test_regression
-------
Traceback (most recent call last):
File "c:\programs\
y", line 183, in runTest
self.
File "C:\Josef\
\test_regressio
assert_
File "C:\Programs\
, in assert_almost_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: -inf
DESIRED: -inf
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= .TestDataDimens ions.test_ mean_squared_ error ------- ------- ------- ------- ------- ------- ------- ------- ------- python25\ lib\site- packages\ nose-0. 11.1-py2. 5.egg\nose\ case.p test(*self. arg) eclipsegworkspa ce\statsmodels- skipper\ scikits\ statsmodels\ tests n.py", line 88, in test_mean_ squared_ error almost_ equal(self. res1.mse_ model, self.res2. mse_model, DECIMAL) Python25\ Lib\site- packages\ numpy\testing\ utils.py" , line 265
FAIL: test_regression
-------
Traceback (most recent call last):
File "c:\programs\
y", line 183, in runTest
self.
File "C:\Josef\
\test_regressio
assert_
File "C:\Programs\
, in assert_almost_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: -inf
DESIRED: -inf
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= .TestNxNx. test_fvalue ------- ------- ------- ------- ------- ------- ------- ------- ------- python25\ lib\site- packages\ nose-0. 11.1...
FAIL: test_regression
-------
Traceback (most recent call last):
File "c:\programs\