为什么为R中的数据集计算四分位数时会得到不同的值?
这些值是不同的
x <- c(66,72,79,84,102,110,123,144,162,169,414)
lowerQ <- median(c(66,72,79,84,102)) ; lowerQ
upperQ <- median(c(123,144,162,169,414)) ; upperQ
这些值
quantile(x)
summary(x)
答案 0 :(得分:2)
计算分位数的方法非常不同(当您拥有连续数据或非连续数据时), 见
?quantile
并查找类型参数
x <- c(66,72,79,84,102,110,123,144,162,169,414)
lowerQ <- median(c(66,72,79,84,102)) ; lowerQ
upperQ <- median(c(123,144,162,169,414)) ; upperQ
quantile(x, type = 1)
66 79 110 162 414
在@joran注释中,请参见Deeper Explanation