commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Otmar Ertl (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (MATH-1277) Incorrect Kendall Tau calc due to data type mistmatch
Date Sun, 20 Sep 2015 08:16:04 GMT

     [ https://issues.apache.org/jira/browse/MATH-1277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Otmar Ertl resolved MATH-1277.
------------------------------
       Resolution: Fixed
    Fix Version/s: 3.6
                   4.0

> Incorrect Kendall Tau calc due to data type mistmatch
> -----------------------------------------------------
>
>                 Key: MATH-1277
>                 URL: https://issues.apache.org/jira/browse/MATH-1277
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Marc Rosen
>            Priority: Minor
>              Labels: Kendall, correlation, tau
>             Fix For: 4.0, 3.6
>
>
> The Kendall Tau calculation returns a number from -1.0 to 1.0
> due to a mixing of ints and longs, a mistake occurs on large size columns (arrays) passed
to the function. an array size of > 50350 triggers the condition in my case - although
it may be data dependent
> the ver 3.5 library returns 2.6 as a result (outside of the defined range of Kendall
Tau)
> with the cast to long below - the result reutns to its expected value
> commons.math3.stat.correlation.KendallsCorrelation.correlation
> here's the sample code I used:
> I added the cast to long of swaps in the 
> 			int swaps = 1077126315;
> 			 final long numPairs = sum(50350 - 1);
> 			    long tiedXPairs = 0;
> 		        long tiedXYPairs = 0;
> 		        long tiedYPairs = 0;
> 		        
> 		  final long concordantMinusDiscordant = numPairs - tiedXPairs - tiedYPairs + tiedXYPairs
- 2 * (long) swaps;
> 	        final double nonTiedPairsMultiplied = 1.6e18;
> 	        double myTest = concordantMinusDiscordant / FastMath.sqrt(nonTiedPairsMultiplied);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message