[Scipy-tickets] [SciPy] #1445: kendalltau Overflow

SciPy Trac scipy-tickets@scipy....
Wed May 25 13:44:11 CDT 2011


#1445: kendalltau Overflow
-------------------------+--------------------------------------------------
 Reporter:  aroth        |       Owner:  somebody
     Type:  enhancement  |      Status:  new     
 Priority:  normal       |   Milestone:          
Component:  Other        |     Version:  0.9.0   
 Keywords:               |  
-------------------------+--------------------------------------------------
 When using scipy.stats.kendalltau computing tau causes an overflow problem
 with large lists. This could be fixed by doing the computation in logspace
 and then exponentiating.

 The offending line is

 {{{
     tau = ((tot - (v + u - t)) - 2.0 * exchanges) / \
                     np.sqrt((tot - u) * (tot - v))
 }}}

 this could be changed to

 {{{
     log_numerator = np.log((tot - (v + u - t)) - 2.0 * exchanges)
     log_denomiantor = 0.5 * (np.log(tot - u) + np.log(tot - v))
     log_tau = log_numerator - log_denomiantor
     tau = np.exp(log_tau)
 }}}

 to solve the problem.

 Cheers,
 Andrew Roth

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1445>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list