Statistics function incorrectly computing median

Muthiah Annamalai muthuspost at gmail.com
Mon Jan 21 05:38:34 CST 2008


>
>>> Michael Godfrey ran some calculations using Matlab's quantile  
>>> function.
>>>
>>> We can now compare Matlab's quantile (), R's summary(), and Maxima's
>>>       
>>>>> quantile (), with the new quantile.m I had hope to add to octave
>>>>>           
>>> (my quantile() calls discrete_inv()).
>>>
>>> Unfortunately, Matlab is an outlier :-(
>>>
>>>       
>> MATLAB seems to have two appropriate functions: quantile.m, prctile.m
>> Help pages:
>> http://www.mathworks.com/access/helpdesk/help/toolbox/stats/quantile.html
>> http://www.mathworks.com/access/helpdesk/help/toolbox/stats/prctile.html
>> Code:
>> http://ecco2.jpl.nasa.gov/data1/matlab/stats/prctile.m
>> As far as I can tell from the help pages, they're essentially the same
>> except that prctile.m uses percentages instead of probabilities.
>>
>> A quick look at the code for prctile.m and also running some tests  
>> suggests
>> that MATLAB is using R's method 5, whereas R's default is method 7.  
>> (I'm
>> talking about R's quantile function.)
>>
>> A Google search comes up with the following user-written quantile.m
>> functions:
>> http://home.online.no/~pjacklam/matlab/software/util/statutil/quantile.m
>> http://www.koders.com/matlab/fidEDEC9319B0EC7E1BCC77A1971511A74F37550100.aspx
>> https://svnserv.cbs.mpg.de/eeglab/browser/branches/eeglab-devel-5.03/eeglab5.03/functions/quantile.m
>>
>> A quick look at the code/descriptions and running some tests  
>> indicates:
>> Acklam's quantile uses method 7 (continuous)
>> Holtsberg's quantile(1) uses method 5 (continuous)
>> Holtsberg's quantile(2) uses method 6 (continuous)
>> Holtsberg's quantile(3) uses method 2 (discrete)
>> Makeig/Finelli's quantile uses method 5 (continuous)
>>
>> -Miguel
>>     
>
> Miguel,
>
> Are any of the licenses for any of those GPL compatible?
>
> Any chance they permit the sample values to non-equal probabilities?
>
> Ben
>   
The URL from koders,

is LGPL maybe.

http://www.koders.com/matlab/fidEDEC9319B0EC7E1BCC77A1971511A74F37550100.aspx

-Muthu




More information about the Bug-octave mailing list