[ 
http://issues.apache.org/jira/browse/MATH-85?page=comments#action_12419186 ] 

Phil Steitz commented on MATH-85:
---------------------------------

I agree this is a corner case and the negative result is due to rounding.  The 
question is, should we force the result to 0 when a negative value is returned 
by the computation? 

> [math]  SimpleRegression getSumSquaredErrors
> --------------------------------------------
>
>          Key: MATH-85
>          URL: http://issues.apache.org/jira/browse/MATH-85
>      Project: Commons Math
>         Type: Bug

>     Versions: 1.1.0
>  Environment: Operating System: Windows 2000
> Platform: PC
>     Reporter: Mark Osborn
>  Attachments: math-85.patch
>
> getSumSquaredErrors returns -ve value. See test below:
> public void testSimpleRegression() {
>               double[] y = {  8915.102, 8919.302, 8923.502};
>               double[] x = { 1.107178495, 1.107264895, 1.107351295};
>               double[] x2 = { 1.107178495E2, 1.107264895E2, 1.107351295E2};
>               SimpleRegression reg = new SimpleRegression();
>               for (int i = 0; i < x.length; i++) {
>                       reg.addData(x[i],y[i]);
>               }
>               assertTrue(reg.getSumSquaredErrors() >= 0.0); // OK
>               reg.clear();
>               for (int i = 0; i < x.length; i++) {
>                       reg.addData(x2[i],y[i]);
>               }
>               assertTrue(reg.getSumSquaredErrors() >= 0.0); // FAIL
>               
>       }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to