Hi, just a quick question regarding to MEDIAN:
with x as (select 1.0 as a union all select 2.0 as a) select sys.median(a) as result from x
returns result=1 i would expect result=1.5 though
any suggestion? thanks milan
On Sun, Sep 21, 2014 at 08:33:08PM +0200, Budulinku Dejmihrasku wrote:
Hi, just a quick question regarding to MEDIAN:
with x as (select 1.0 as a union all select 2.0 as a) select sys.median(a) as result from x
returns result=1 i would expect result=1.5 though
1.5 is not a value in the input. Median should always return a value from the input.
Niels
any suggestion? thanks milan
users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Niels Thanks for the quick response however
http://en.wikipedia.org/wiki/Median
and quote:
"If there is an even number of observations, then there is no single middle value; the median is then usually defined to be the mean http://en.wikipedia.org/wiki/Arithmetic_meanof the two middle values ^[1] http://en.wikipedia.org/wiki/Median#cite_note-StatisticalMedian-1 ^[2] http://en.wikipedia.org/wiki/Median#cite_note-2 (the median of {3, 5, 7, 9} is (5 + 7) / 2 = 6)...."
so by this definition median of {1,2} should return 1.5 running this in Oracle, MSExcel, etc. i get 1.5 as well
if i miss something, or the definition of the Median is different in MonetDB - please let me know thanks in advance milan
On 21. 9. 2014 21:22, Niels Nes wrote:
On Sun, Sep 21, 2014 at 08:33:08PM +0200, Budulinku Dejmihrasku wrote:
Hi, just a quick question regarding to MEDIAN:
with x as (select 1.0 as a union all select 2.0 as a) select sys.median(a) as result from x
returns result=1 i would expect result=1.5 though
1.5 is not a value in the input. Median should always return a value from the input.
Niels
any suggestion? thanks milan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
On Sun, Sep 21, 2014 at 11:10:41PM +0200, Budulinku Dejmihrasku wrote:
Niels Thanks for the quick response however
http://en.wikipedia.org/wiki/Median
The Median in MonetDB is mapped to Quantile(0.5) which doesn't have any mean of the middle values.
http://en.wikipedia.org/wiki/Quantile
Niels
and quote:
"If there is an even number of observations, then there is no single middle value; the median is then usually defined to be the mean of the two middle values ^[1] ^[2] (the median of {3, 5, 7, 9} is (5 + 7) / 2 = 6)...."
so by this definition median of {1,2} should return 1.5 running this in Oracle, MSExcel, etc. i get 1.5 as well
if i miss something, or the definition of the Median is different in MonetDB - please let me know thanks in advance milan
On 21. 9. 2014 21:22, Niels Nes wrote:
On Sun, Sep 21, 2014 at 08:33:08PM +0200, Budulinku Dejmihrasku wrote: Hi, just a quick question regarding to MEDIAN: with x as (select 1.0 as a union all select 2.0 as a) select sys.median(a) as result from x returns result=1 i would expect result=1.5 though 1.5 is not a value in the input. Median should always return a value from the input. Niels any suggestion? thanks milan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
not happy but thanks for the explanation m.
On 22. 9. 2014 7:58, Niels Nes wrote:
The Median in MonetDB is mapped to Quantile(0.5) which doesn't have any mean of the middle values.
http://en.wikipedia.org/wiki/Quantile
Niels
To achieve happiness, you can create your own UDF!
Lefteris
On Mon, Sep 22, 2014 at 8:29 AM, Budulinku Dejmihrasku < budulinku.dejmihrasku@gmail.com> wrote:
not happy but thanks for the explanation m.
On 22. 9. 2014 7:58, Niels Nes wrote:
The Median in MonetDB is mapped to Quantile(0.5) which doesn't have any mean of the middle values.
http://en.wikipedia.org/wiki/Quantile
Niels
users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Hi,
maybe this helps:
CREATE AGGREGATE Rmedian(arg1 double) RETURNS double LANGUAGE R { quantile(arg1, 0.5) };
SELECT median(val), Rmedian(val) FROM (SELECT 1.0 as val UNION ALL SELECT 2.0) as virttable;
This returns: 1 for the median() and 1.5 for the Rmedian() set functions.
To use the: LANGUAGE R { quantile(arg1, 0.5) } functionality you will need to use: - the latest MonetDB developer built and - start the mserver5 with option: --set embedded_r=true
Regards, Martin van Dinther
On 22-09-14 08:58, Lefteris wrote:
To achieve happiness, you can create your own UDF!
Lefteris
On Mon, Sep 22, 2014 at 8:29 AM, Budulinku Dejmihrasku <budulinku.dejmihrasku@gmail.com mailto:budulinku.dejmihrasku@gmail.com> wrote:
not happy but thanks for the explanation m. On 22. 9. 2014 7:58, Niels Nes wrote: The Median in MonetDB is mapped to Quantile(0.5) which doesn't have any mean of the middle values. http://en.wikipedia.org/wiki/Quantile Niels
cool - thanks!
On 26. 9. 2014 14:19, martin van dinther wrote:
Hi,
maybe this helps:
CREATE AGGREGATE Rmedian(arg1 double) RETURNS double LANGUAGE R { quantile(arg1, 0.5) };
SELECT median(val), Rmedian(val) FROM (SELECT 1.0 as val UNION ALL SELECT 2.0) as virttable;
This returns: 1 for the median() and 1.5 for the Rmedian() set functions.
To use the: LANGUAGE R { quantile(arg1, 0.5) } functionality you will need to use:
- the latest MonetDB developer built and
- start the mserver5 with option: --set embedded_r=true
Regards, Martin van Dinther
On 22-09-14 08:58, Lefteris wrote:
To achieve happiness, you can create your own UDF!
Lefteris
On Mon, Sep 22, 2014 at 8:29 AM, Budulinku Dejmihrasku <budulinku.dejmihrasku@gmail.com mailto:budulinku.dejmihrasku@gmail.com> wrote:
not happy but thanks for the explanation m. On 22. 9. 2014 7:58, Niels Nes wrote: The Median in MonetDB is mapped to Quantile(0.5) which doesn't have any mean of the middle values. http://en.wikipedia.org/wiki/Quantile Niels
users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
participants (4)
-
Budulinku Dejmihrasku
-
Lefteris
-
martin van dinther
-
Niels Nes