This is a very simple question but it’s interesting too. In some very influential domestic textbooks of statistics (e.g. Jia Junping, 2004), the definition for quartiles are not appropriate. I didn’t notice this point until a member of COS raised a question about how to compute quartiles in M$ Excel; he just doubted the results computed by the formula QUANTILE() of Excel according to those famous textbooks: the lower and upper quartiles are respectively defined at (n+1)/4 and 3*(n+1)/4. While I believe [(n+1)/2 + 1]/2 and [(n+1)/2 + 1]/2 are better.
Actually when I made some tests in R, Excel, SPSS, Stata and Statistica, I found that all these statistical packages computed quartiles in the latter way except SPSS, which adopted the former way. Just use five numbers from 1 to 5 to test the results: if the lower quartile is 2, then the latter way is used, otherwise 1.5 means the former.
My another interesting finding in SPSS is that it computes quartiles in the former way but draws boxplots in the latter way. Again we may use 1, 2, 3, 4, 5 to confirm it. The quartiles presented in the boxplot are 2 and 4, whereas computed by “Frequencies” are 1.5 and 4.5.
赞赏
作为一名没有固定工作的自由职业者,我非常感谢您通过捐赠的方式来支持我的写作和开源软件开发。当然,捐赠纯属自愿。无论金额多少,都是一片诚挚的心意。支付方式如下:
| 微信 | ← 奋力支开它俩 → | 支付宝 |
|---|---|---|
![]() |
其它爱心通道 ↓ Venmo: @yihui_xie Zelle: xie@yihui.name PayPal: xie@yihui.name |
![]() |
若使用 Venmo/Zelle/Paypal,请添加备注“gift”或“donation”,以免捐赠被视为我的可税收入。若使用 Paypal,支付类型请选 Family and Friends,而不要选 Goods and Services。
在不影响生活的前提下,我会将收到的捐赠以尽量大的比例回馈给开源社区和慈善机构。作为参考,2024-25 年间我共收到约三万美元捐赠,完税后我转手捐出了一万五千美元。

