Statistics function incorrectly computing median
Ben Abbott
bpabbott at mac.com
Thu Jan 24 07:46:02 CST 2008
On Jan 22, 2008, at 10:27 AM, Miguel Garcia-Blanco wrote:
>>
>> How is the following list for a short plan?
>>
>> (1) Add prctile.m
>> (2) Add quantile.m
>> (3) Change to statistic.m (call quantile.m)
>
> Looks good.
>
>> (4) Modify discrete_inv.m to use R's method #2
>> (5) Verify consistency of discrete_pdf/cdf/rnd.
>
> Be aware that changing discrete_inv.m will also change empirical_inv.m
> (currently working as expected) and unidinv.m (currently conforms with
> MATLAB: "X = unidinv(P,N) returns the smallest positive integer X
> such that
> the discrete uniform cdf evaluated at X is equal to or exceeds
> P." [2]).
Ok. I decided to place Matlab compatibility as a high priority (when
applicable). I do not have access to Matlab's statistics toolbox, and
have relied upon Michael Godfrey to verify how Matlab handles NaN's,
Inf's, as well as other compatibility issues (thanks Michael).
To avoid breaking unidinv's compatibility with Matlab, I decided to
avoid (4) and (5) above.
The three functions prctile, quantile, and statistics each depend upon
__quantile__.m (a new function). Since variants of the quantile
function exists in Maxima and GNU's R, I've included those methods as
well. (See help quantile).
At the moment prctile.m respects Matlab's variant, with no optional
support for R's methods.
It has been many years since I did any substantial statistics work, so
the nomenclature help contained in the scripts might be misleading/
confusing. Feel free to send corrections.
I've attached the new scripts (and the modified statistics script).
For those interested, please review and test them.
There are several tests included as well ("text quantile" for example).
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: __quantile__.m
Type: application/octet-stream
Size: 4260 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080124/4a333ac3/attachment-0004.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prctile.m
Type: application/octet-stream
Size: 4254 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080124/4a333ac3/attachment-0005.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: statistics.m
Type: application/octet-stream
Size: 2639 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080124/4a333ac3/attachment-0006.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quantile.m
Type: application/octet-stream
Size: 8601 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080124/4a333ac3/attachment-0007.obj
More information about the Bug-octave
mailing list