300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 分位数和分位线(Quantiles and Percentiles)

分位数和分位线(Quantiles and Percentiles)

时间:2024-01-27 12:50:46

相关推荐

分位数和分位线(Quantiles and Percentiles)

分位数有种积分(累积)的含义在。分位数(即将数据由低至高排列,小于该数的数据占总体的比例达到时最终落到的数):

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 reproducibilityx = 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.5389Y = prctile(x,42)Y =5.6709

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。