bugGNU Octave - Bugs: bug #29600, median() returns wrong result...

 
 

bug #29600: median() returns wrong result (sometimes)

Submitted by:  None
Submitted on:  Sun 18 Apr 2010 08:20:02 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Matěj TýčOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.2.3
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 19 Apr 2010 04:29:04 AM UTC, comment #1:

The definition of the median function depends on the number of elements in the dataset. If the number of elements is odd, then the median is just the middle element of the dataset when they have been ordered from lowest to highest. If the number of elements is even then the median is equal to the average (mean) of the two middle elements. See http://en.wikipedia.org/wiki/Median for further reference.

As examples,
median(1:5) = 3
median(1:4) = 2.5 [the average of the two middle elements 2 and 3]

This is not a bug.

Rik <rik5>
Project Administrator
Sun 18 Apr 2010 08:20:02 PM UTC, original submission:

Hello, try running this:

some = rand(4,2);
median(some, 1)

I get this results:
octave:22> some = rand(4,2)
some =

0.362178 0.605746
0.383044 0.664575
0.032583 0.191176
0.122265 0.993386

octave:23> median(some, 1)
ans =

0.24222 0.63516

It seems that it is not a median, but a mean value...

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 19 Apr 2010 04:29:04 AM UTCrik5StatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1