简体   繁体   中英

Divide by zero encountered in orthogonal regression with python (scipy.odr)

Following this discussion to perform Orthogonal distance regression , it happens that for a specific data set, the routine encounters an error:

/usr/local/lib/python2.7/site-packages/scipy/odr/odrpack.py:361: RuntimeWarning: divide by zero encountered in true_divide
return 1./numpy.power(sd, 2)
Beta: [ nan  nan]
Beta Std Error: [ 0.  0.]
Beta Covariance: [[ 0.  0.]
                  [ 0.  0.]]
Residual Variance: 0.0
Inverse Condition #: 0.0482240040702
Reason(s) for Halting:
   Numerical error detected

I thought it was due to some null elements in the regressed array, but it seems this is not the case. The documentation about the use of scipy.odr is very scarce, and I am not expert, so I don't know what is happening. What is sd ? What are the calculations leading to this error?

EDIT: this is the data set which returns the error, and this is the aray of associated errors.

The associated errors must not be zero. They can be replaced with NaN values for example or removed from the dataset.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM