就R幫助help(quantile)
,你可以看到如何計算R中的百分位數?
Type 7 m = 1-p. p[k] = (k - 1)/(n - 1). In this case, p[k] =mode[F(x[k])].
This is used by S.
現在,我有一個例子:
w<-c(75,64,47.4,66.9,62.2,62.2,58.7,63.5,66.6,64,57,69,56.9,50,72.0)
sort(w)
[1] 47.4 50.0 56.9 57.0 58.7 62.2 62.2 63.5 64.0 64.0 66.6 66.9 69.0 72.0 75.0
quantile(w)
0% 25% 50% 75% 100%
47.40 57.85 63.50 66.75 75.00
你怎麼能使用7型公式得到的結果?
您是否閱讀了幫助中列出的Hyndman和Fan參考? – mnel 2013-03-11 00:25:13
*是* 7型公式(這是R'quantile'中的默認值)。你可以從參數的默認值中看出:'quantile(x,probs = seq(0,1,0.25),na.rm = FALSE,names = TRUE,type = 7,...)' – 2013-03-11 00:26:22