[R] the quantile function and problems.

Ebert,Timothy Aaron tebert @end|ng |rom u||@edu
Fri Jul 15 17:54:31 CEST 2022


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 using r-project.org> On Behalf Of Ivan Krylov
Sent: Friday, July 15, 2022 2:21 AM
To: Uwe Brauer <oub using mat.ucm.es>
Cc: r-help using r-project.org
Subject: Re: [R] the quantile function and problems.

[External Email]

В 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

______________________________________________
R-help using 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&e=
PLEASE 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&e=
and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list