分位数和分位线(Quantiles and Percentiles)
2017-03-03 11:06
204 查看
分位数有种积分(累积)的含义在。
分位数(即将数据由低至高排列,小于该数的数据占总体的比例达到时最终落到的数):
10%:3000元
20%:5200元
50%:20000元
80%:41500元
90%:50000元
quantile initially assigns the sorted values in X to the (0.5/n), (1.5/n), …, ([n – 0.5]/n) quantiles. For example:
((1:n)-.5)/n
n 表示序列的长度;
For a data vector of six elements such as {6, 3, 2, 10, 8, 1}, the sorted elements {1, 2, 3, 6, 8, 10} (先排序)respectively correspond to the (0.5/6), (1.5/6), (2.5/6), (3.5/6), (4.5/6), and (5.5/6) quantiles.
For a data vector of five elements such as {2, 10, 5, 9, 13}, the sorted elements {2, 5, 9, 10, 13} respectively correspond to the 0.1, 0.3, 0.5, 0.7, and 0.9 quantiles.
分位数(即将数据由低至高排列,小于该数的数据占总体的比例达到时最终落到的数):
10%:3000元
20%:5200元
50%:20000元
80%:41500元
90%:50000元
1. 分位数定义
分位数还是序列中的数,只不过序列要首先进行排序;quantile initially assigns the sorted values in X to the (0.5/n), (1.5/n), …, ([n – 0.5]/n) quantiles. For example:
((1:n)-.5)/n
n 表示序列的长度;
For a data vector of six elements such as {6, 3, 2, 10, 8, 1}, the sorted elements {1, 2, 3, 6, 8, 10} (先排序)respectively correspond to the (0.5/6), (1.5/6), (2.5/6), (3.5/6), (4.5/6), and (5.5/6) quantiles.
For a data vector of five elements such as {2, 10, 5, 9, 13}, the sorted elements {2, 5, 9, 10, 13} respectively correspond to the 0.1, 0.3, 0.5, 0.7, and 0.9 quantiles.
2. 自定义函数
function val = SpecialPercentile(arr, pct) len = length(arr); ind = floor(pct/100*len); % floor 取整,因为该数要作为索引 newarr = sort(arr); % 排序,渐增排序; val = newarr(ind); end
3. matlab 内置函数
Y = prctile(X,p)
rng('default'); % for reproducibility x = normrnd(5,2,1,10) x = 6.0753 8.6678 0.4823 6.7243 5.6375 2.3846 4.1328 5.6852 12.1568 10.5389 Y = prctile(x,42) Y = 5.6709
相关文章推荐
- 【算法导论学习-017】k分位数(the Kth quantiles)
- ES权威指南_04_aggs_08 Approximate Aggs(近似聚合:cardinality and percentiles)
- UVA 10061 How many zero's and how many digits ? (m进制,阶乘位数,阶乘后缀0)
- 四分位数(Quartiles)、十分位数(Deciles)和百分位数(Percentiles
- 从一个n位数中选出m位按顺序组成新数并使其最大 || Erasing and Winning UVA - 11491
- LightOJ1282_Leading and Trailing _对数求前三位数&快速幂
- Build L2TP over IPSec on Linux(Using OpenSwan and l2tpd.0.69)
- Compiling and Integrating Crypto++ into the Microsoft Visual C++ Environment
- about the basketball and the waltz
- Shaders for Game Programmers and Artists代码实现Chapter_0506b
- 使用ANSI C and Microsoft C++中常用的预定义宏
- request.sendRedirect and responsed.getRequestDispather.forward 的区别
- [LeetCode 121] - 买入与卖出股票的最佳时机(Best Time to Buy and Sell Stock)
- Type difference of character literals in C and C++
- Bash String Manipulation Examples – Length, Substring, Find and Replace
- hdu 4988 Little Pony and Boast Busters ( 树状数组+treap )
- scala Futures and Promises
- Hoeffding inequality and bound
- Lock and Thread in JAVA
- hdu 1848 Fibonacci again and again