You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2012/11/08 19:38:12 UTC

[jira] [Commented] (MATH-891) SpearmansCorrelation fails when using NaturalRanking together with NaNStrategy.REMOVED

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

Thomas Neidhart commented on MATH-891:
--------------------------------------

Test case:

{noformat}
        double[] column1 = new double[] { Double.NaN, 1, 2 };
        double[] column2 = new double[] { 10, 2, 10 };

        Array2DRowRealMatrix mydata = new Array2DRowRealMatrix(column1.length, 2);
        for (int i = 0; i < column1.length; i++) {
            mydata.addToEntry(i, 0, column1[i]);
            mydata.addToEntry(i, 1, column2[i]);
        }

        // compute correlation
        NaturalRanking ranking = new NaturalRanking(NaNStrategy.REMOVED);
        SpearmansCorrelation spearman = new SpearmansCorrelation(mydata, ranking);
        double correlations = spearman.correlation(column1, column2);
        System.out.println("correlations " + correlations);
{noformat}
                
> SpearmansCorrelation fails when using NaturalRanking together with NaNStrategy.REMOVED
> --------------------------------------------------------------------------------------
>
>                 Key: MATH-891
>                 URL: https://issues.apache.org/jira/browse/MATH-891
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Thomas Neidhart
>
> As reported by Martin Rosellen on the users mailinglist:
> Using a NaturalRanking with a REMOVED NaNStrategy can result in an exception when NaN are contained in the input arrays.
> The current implementation just removes the NaN values where they occur, without taken care to remove the corresponding values in the other array.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira