[R] the quantile function and problems.

Ebert,Timothy Aaron
Fri, 15 Jul 2022 15:54:31 -0000

Does the choice in how the quantile is calculated influence the validity of a
statistical test for differences in the median?
Regards,
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Ivan Krylov
Sent: Friday, July 15, 2022 2:21 AM
To: Uwe Brauer <oub at mat.ucm.es>
Cc: r-help at r-project.org
Subject: Re: [R] the quantile function and problems.

[External Email]

? 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

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

--
Best regards,
Ivan

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=27y7tm3H4Dbasv87iGgaE8-1NMw7x-Skvgftsip0_qqJw5CpboxBiPDg8Hggx-xs&s=dYjPPV9FhTSt-KjJZLi6AXh_PNykZSwIhfrk2E4saXw&ePLEASE
do read the posting guide
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=27y7tm3H4Dbasv87iGgaE8-1NMw7x-Skvgftsip0_qqJw5CpboxBiPDg8Hggx-xs&s=QJ2jSyuRERB_vwvrBw6zUnAUgY6Bals14F_ODjiqPcA&eand
provide commented, minimal, self-contained, reproducible code.