[Scipy-tickets] [SciPy] #73: Statistics Review: scoreatpercentile

SciPy scipy-tickets at scipy.net
Tue Dec 5 09:10:26 CST 2006


#73: Statistics Review: scoreatpercentile
-------------------------+--------------------------------------------------
 Reporter:  rkern        |        Owner:  rkern                   
     Type:  review       |       Status:  assigned                
 Priority:  normal       |    Milestone:  Statistics Review Months
Component:  scipy.stats  |      Version:  devel                   
 Severity:  normal       |   Resolution:                          
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by dhuard):

 Here is a fix, using empiricalcdf defined in Ticket 74.
 {{{
 def scoreatpercentile(data, per):
     """Return the score at the given 'per' percentile of the data.

     Example
     >>> scoreatpercentile(randn(100), 50)
     will return the median of the sample.
     """
     cdf = empiricalcdf(data)
     interpolator = interpolate.interp1d(sort(cdf), sort(data))
     return interpolator(per/100.)
 }}}

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


More information about the Scipy-tickets mailing list