[R] the quantile function and problems.

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Jul 15 08:20:42 CEST 2022


В Thu, 14 Jul 2022 14:58:17 +0200
Uwe Brauer <oub using 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

Choose the ones that fit your ideas of quantile best. See ?quantile for
more info.

-- 
Best regards,
Ivan



More information about the R-help mailing list