Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Finding the median

Re: Finding the median

From: <sw_at_weinerfamily.org>
Date: Mon, 04 Dec 2000 15:08:45 GMT
Message-ID: <3A2BB34E.909120E5@weinerfamily.org>

Could you give me an example? I used the following psuedo algorithm to find median:
num = number of elements
 IF mod(num,2) <> 0 THEN

    median = ROW_NUMBER(num/2 + 1)
ELSE
    median = ROW_NUMBER((num/2))+ROW_NUMBER((num/2) + 1))/2 END IF Thanks!

Jonathan Lewis wrote:

> In fact, I suggested percentiles because
> of the spurious impression of accuracy -
> it is easier and more efficient to consider
> 'bi-'tiling the data using ntile(2).
>
> --
> Jonathan Lewis
> Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
>
> Practical Oracle 8i: Building Efficient Databases
>
> Publishers: Addison-Wesley
> Book bound date: 8th Dec 2000
> See a first review at:
> http://www.ixora.com.au/resources/index.htm#practical_8i
> More reviews at: http://www.jlcomp.demon.co.uk/book_rev.html
>
> Jonathan Lewis wrote in message
> <975744165.27815.0.nnrp-04.9e984b29_at_news.demon.co.uk>...
> >
> >I know what the median is - perhaps we
> >differ on our interpretation of percentiles.
> >
> >Sort the data in order, then split it into
> >100 buckets so that each buck contains
> >exactly the same number of items.
> >
> >Bucket 1 contains the 1% of the population
> >with the lowest score etc. By the time you
> >get to bucket 50 you have half the population
> >behind you - so the top value of bucket 50,
> >the bottom value in bucket 51, or the average
> >of the two MUST be the median value.
> >
> >
> >--
> >Jonathan Lewis
> >Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
> >
> >Practical Oracle 8i: Building Efficient Databases
> >
> >Publishers: Addison-Wesley
> >Book bound date: 8th Dec 2000
> >See a first review at:
> >http://www.ixora.com.au/resources/index.htm#practical_8i
> >More reviews at: http://www.jlcomp.demon.co.uk/book_rev.html
> >
> >
> >
> >Paul Q wrote in message ...
> >>No, May not even be that close.
> >>The median is defined as that which is "situated in the middle", and it is
> >>calculated quite differently from the mean. For example, the six friends
 in
> >>our example go shopping, and they spend the following amounts of money:
> >>$15.00, $24.50, $3.75, $43.99, $28.10, and $17.68. First, the values in
> >>question are all arranged in numerical order. In this case the order is:
> >>$3.75, $15.00, $17.68, $24.50, $28.10, $43.99. If there were an odd
 number
> >>of values, the middle value would be considered the median. Since there
 are
> >>an even number in this example, the median is the mean of the two middle
> >>values. Those values are 17.68 and 24.50, and the mean of those two is
> >>21.09. Therefore, the median amount is $21.09. The median is most often
> >>used when there are values which are very high or very low.
> >>
> >>
> >>"Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote in message
> >>news:975707338.5062.0.nnrp-01.9e984b29_at_news.demon.co.uk...
> >>>
> >>> There is no built-in.
> >>> But if you have 8.1.6 you might be able to
> >>> use the Analytic functions to good effect.
> >>> e.g. Would the highest value in the 50th
> >>> percentile be a reasonable approximation ?
> >>>
> >>>
> >>> --
> >>> Jonathan Lewis
> >>> Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
> >>>
> >>> Practical Oracle 8i: Building Efficient Databases
> >>>
> >>> Publishers: Addison-Wesley
> >>> Book bound date: 8th Dec 2000
> >>> See a first review at:
> >>> http://www.ixora.com.au/resources/index.htm#practical_8i
> >>> More reviews at: http://www.jlcomp.demon.co.uk/book_rev.html
> >>>
> >>>
> >>>
> >>> sw_at_weinerfamily.org wrote in message
 <3A27F23C.3A111F35_at_weinerfamily.org>...
> >>> >Given a column of numbers, how do I calculate the median? I don't see a
> >>> >function to do it. Do I need to write a procedure?
> >>> >
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
Received on Mon Dec 04 2000 - 09:08:45 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US