Tcl Library Source Code

View Ticket
Login
Ticket UUID: 51c03aac1a45161ab6cc59afb69d1768175e054c
Title: Error raised in mv-ols for what should be valid input
Type: Bug Version: 1.18
Submitter: anonymous Created on: 2017-09-28 22:33:10
Subsystem: math :: statistics Assigned To: arjenmarkus
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-10-06 20:59:59
Resolution: Fixed Closed By: arjenmarkus
    Closed on: 2017-10-06 20:59:59
Description:
::math::statistics::mv-ols {{0 25125 128} {0 23224 64} {0 37903 512} {0 21263 32} {0 22053 64} {0 25745 256} {0 25745 256} {0 21557 32} {0 24935 128} {0 22904 64} {0 21422 32} {0 21947 32} {0 33244 512} {0 33244 512} {0 30060 512} {0 29691 256} {0 30439 256} {0 23724 128} {0 22541 64} {0 23640 128} {0 21422 32} {0 23640 128} {0 22249 64} {0 28247 512} {0 23333 32} {0 29841 256} {0 23959 128} {0 30819 512} {0 26333 256} {0 22145 32} {0 23863 128} {0 20772 32} {0 28511 512} {0 22425 64} {0 21598 32} {0 26335 256} {0 23816 128} {0 21157 32} {0 20973 32} {0 20973 32} {0 35125 512} {0 20679 32} {0 21241 64} {0 25297 256} {0 22301 32} {0 22007 32} {0 33351 512} {0 24115 128} {0 24115 128} {0 22301 32} {0 22797 64} {0 22593 64} {0 26439 256} {0 21255 32} {0 22645 32} {0 23447 128} {0 24205 64} {0 25051 128} {0 21007 32} {0 28237 256} {0 25546 128} {0 25669 256} {0 25669 256} {0 25669 256} {0 21977 64} {0 21977 64} {0 26187 128} {0 38360 512} {0 31846 256} {0 28349 256} {0 26450 128}}

This dies with the following error message.  It seems to me that regression should work even if all y values are 0.  It's a pretty boring regression, but not worth failing over.  Maybe just needs a special case to handle this kind of input.

 domain error: argument not in valid range
    while executing
"expr {double($ssreg)/$sstot}"
    (procedure "mv-wls" line 111)
    invoked from within
"mv-wls $newdata"
    (procedure "::math::statistics::mv-ols" line 6)
    invoked from within
"::math::statistics::mv-ols $data"
User Comments: arjenmarkus added on 2017-10-06 20:59:59:
Yes, the problem occurred in the calculation of the correlation coefficient. I have introduced a special case for this situation, returning a value of 1.

aku added on 2017-10-04 21:37:29:
I suspect that the `$sstot` in the expression is 0, making it a div-by-zero issue. Handing to Arjen.