Statistics function incorrectly computing median

Ben Abbott bpabbott at mac.com
Sun Jan 13 09:52:38 CST 2008


On Jan 6, 2008, at 8:36 PM, Ben Abbott wrote:

>
> On Jan 7, 2008, at 7:17 AM, Miguel Garcia-Blanco wrote:
>
>>> Please see the attached file and compare my results to R .... and  
>>> I'd  like to see the results if they differ from mine.
>>
>> Both results agree. (See attached file: R_results.txt)
>>
>> -Miguel<R_results.txt>
>
> I've attached the modified script. However, there are additional  
> scripts, such as discrete_pdf.m that are written in a manner  
> consistent with the original version of discrete_inv.m.
>
> Thus, I don't think we are ready for a patch.
>
> Ben
>

Miguel/others,

I took another look and found a method that is more consistent with  
the original algorithm. The original calculates the CDF from left to  
right.  So I added an equivalent calculation form right to left, and  
averaged the two results.

I expect the result will be the same calculated by GNU's R.

I've attached a diff as well as a complete m-file.

Comments?

Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: discrete_inv.m
Type: application/octet-stream
Size: 2826 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080113/61f85eaf/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discrete_inv.diff
Type: application/octet-stream
Size: 1169 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080113/61f85eaf/attachment-0003.obj 


More information about the Bug-octave mailing list