[R] the quantile function and problems.

Uwe Brauer
Fri, 15 Jul 2022 19:29:19 -0000

>>> "IK" == Ivan Krylov <krylov.r00t at gmail.com>
writes:

> ? Thu, 14 Jul 2022 14:58:17 +0200
> Uwe Brauer <oub at mat.ucm.es> ?????:

>> What turns me crazy is that the way R, matlab and the JCR calculate
>> the quartiles gives different results.

> R by itself can give up to 9 slightly different results:

> sapply(1:9, function(type) quantile(1:267, 1:3/4, type = type))
> #     [,1] [,2] [,3]   [,4]   [,5] [,6]  [,7]      [,8]     [,9]
> # 25%   67   67   67  66.75  67.25   67  67.5  67.16667  67.1875
> # 50%  134  134  134 133.50 134.00  134 134.0 134.00000 134.0000
> # 75%  201  201  200 200.25 200.75  201 200.5 200.83333 200.8125

Thanks, number 3 is the best for my purpose.

Very useful



--
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.