[SciPy-user] Limits of linrgress - underflow encountered in stdtr

josef.pktd@gmai... josef.pktd@gmai...
Mon Jun 8 18:13:44 CDT 2009


On Mon, Jun 8, 2009 at 5:16 PM, wierob<wierob83@googlemail.com> wrote:
> Hi,
>
>> turn of numpy.seterr(all="raise")
>> as explained in the reply to your previous messages
>>
>> Josef
>>
> turning of the error reporting doesn't prevent the error. Thus the
> result may be wrong, doesn't it? E.g. a p-value of 0.0 looks suspicious.
>

anything else than a p-value of 0 would be suspicious, you have a
perfect fit and the probability is zero that we observe a slope equal
to the estimated slope under the null hypothesis( that the slope is
zero). So (loosely speaking) we can reject the null of zero slope with
probability 1.
The result is not "maybe" wrong, it is correct. your r_square is 1,
the standard error of the slope estimate is zero.


floating point calculation with inf are correct (if they don't have a
definite answer we get a nan). Dividing a non-zero number by zero has
a well defined result, even if python raises a zerodivisionerror.

>>> np.array(1)/0.
inf
>>> 1/(np.array(1)/0.)
0.0
>>> np.seterr(all="raise")
{'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'}
>>> 1/(np.array(1)/0.)
Traceback (most recent call last):
  File "<pyshell#39>", line 1, in <module>
    1/(np.array(1)/0.)
FloatingPointError: divide by zero encountered in divide

Josef


More information about the SciPy-user mailing list