You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2010/03/11 12:20:28 UTC

[jira] Issue Comment Edited: (MATH-350) Regression in package "regression"

    [ https://issues.apache.org/jira/browse/MATH-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844022#action_12844022 ] 

Gilles edited comment on MATH-350 at 3/11/10 11:18 AM:
-------------------------------------------------------

Unit test from the user who discovered the issue. Copying it into the
  src/test/java/org/apache/commons/math/stat/regression
directory of the CM source tree, and running the tests will result in the following output:

{noformat}
Running org.apache.commons.math.stat.regression.OLSRegressionCompare20To21Test
Test parameters
Test variance
Expected 2.7104787386850834E-26 Actual 1.091646231028372E-25
Constructed a polynomial of degree 2
System will model various degrees of polynomial and use an Ftest to find the best model


Testing trend of degree 1
OLSRegressionCompare20To21Test: model statistic: 1545.9235701200896 threshold 3.9381110982233225
Model with degree 1 is better - keep testing higher order models

Testing trend of degree 2
OLSRegressionCompare20To21Test: model statistic: 8.9522618877706E31 threshold 3.939126144339758
Model with degree 2 is better - keep testing higher order models

Testing trend of degree 3
OLSRegressionCompare20To21Test: model statistic: 109.12572361790322 threshold 3.940162735266305
Model with degree 3 is better - keep testing higher order models

Testing trend of degree 4
OLSRegressionCompare20To21Test: model statistic: -40.823878611285174 threshold 3.941221564253479
Model with degree 4 is rejected - keeping simple model and exiting
Best model found with degree = 3
Coeff 0 = 3.000000000000148
Coeff 1 = 1.2000000000000006
Coeff 2 = 0.3399999999999999
Coeff 3 = 1.0632735348660702E-18
Test residuals
Test standard errors
Test hat matrix
Test parameter variance
{noformat}

So, although the last coefficient is nearly zero, it is conceptually wrong to return a fit with a polynomial of degree 3 whereas the input data was generated from a polynomial of degree 2.
[CM 2.0 behaved properly in this respect.]


      was (Author: erans):
    Unit test from the user who discovered the issue. Copying it into the
  src/test/java/org/apache/commons/math/stat/regression
directory of the CM source tree, and running the tests will result in the following output:

{noformat}
Running org.apache.commons.math.stat.regression.OLSRegressionCompare20To21Test
Test parameters
Test variance
Expected 2.7104787386850834E-26 Actual 1.091646231028372E-25
Constructed a polynomial of degree 2
System will model various degrees of polynomial and use an Ftest to find the best model


Testing trend of degree 1
OLSRegressionCompare20To21Test: model statistic: 1545.9235701200896 threshold 3.9381110982233225
Model with degree 1 is better - keep testing higher order models

Testing trend of degree 2
OLSRegressionCompare20To21Test: model statistic: 8.9522618877706E31 threshold 3.939126144339758
Model with degree 2 is better - keep testing higher order models

Testing trend of degree 3
OLSRegressionCompare20To21Test: model statistic: 109.12572361790322 threshold 3.940162735266305
Model with degree 3 is better - keep testing higher order models

Testing trend of degree 4
OLSRegressionCompare20To21Test: model statistic: -40.823878611285174 threshold 3.941221564253479
Model with degree 4 is rejected - keeping simple model and exiting
Best model found with degree = 3
Coeff 0 = 3.000000000000148
Coeff 1 = 1.2000000000000006
Coeff 2 = 0.3399999999999999
Coeff 3 = 1.0632735348660702E-18
Test residuals
Test standard errors
Test hat matrix
Test parameter variance
{noformat}

So, although the last coefficient is nearly zero, it is conceptually wrong to return a fit with a polynomial of degree 3 whereas the input data was generated from a polynomial of degree 2.
[CM 2.0 behave properly in this respect.]

  
> Regression in package "regression"
> ----------------------------------
>
>                 Key: MATH-350
>                 URL: https://issues.apache.org/jira/browse/MATH-350
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Gilles
>         Attachments: OLSRegressionCompare20To21Test.java
>
>
> There is a regression in class "OLSMultipleLinearRegression".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.