Package: num-utils
Version: 0.5-3
Severity: minor
File: /usr/bin/numaverage


'numaverage -m' works as expected if there's a unique mode:

    % { echo 2 ; seq 6 ; } |  numaverage -m
    2

...but with a uniform distribution it returns the first mode:

    % { echo 22 ; seq 6 ; } |  numaverage -m
    22
    % seq 6 |  numaverage -m
    1

Maybe that should be documented in the man page.

Observations:

    % { echo 2 ; echo 5 ; seq 6 ; } |  numaverage -m
    2
    % { echo 5 ; echo 2 ; seq 6 ; } |  numaverage -m
    2

When there's two modes, it returns the first.  (see above)

    % { echo 3 ; echo 2 ;  seq 6 ; } |  numaverage -m   # example A
    2
    % { echo 1 ; echo 2 ;  seq 6 ; } |  numaverage -m   # example B
    1

The "first" mode seems to be the "first completed".  Hence
Even though the first '3' is before the first '2' in 'example A', the
final '2' comes before the final '3', so '2' is the first mode.

Suggested man page revision.  Before:

           -m  Find the mode (most occuring) of the list of numbers.

After:

           -m  Find the mode (most occuring) in the list of numbers,
               or when there's more than one mode, the first completed
               mode.    

Reference:

        http://en.wikipedia.org/wiki/Mode_%28statistics%29

Hope this helps...


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.16-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)

Versions of packages num-utils depends on:
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 

num-utils recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to