楼主 nothingwmm |
另一种写法:
1.第一个四分位数: k=(1/4)*(4-1)+1=1.75,所以 f=0.75 第一个四分位数=第一个值+0.75*(第二个值-第一个值)=1+0.75*(4-1)=3.25 2.第二个四分位数: k=(2/4)*(4-1)+1=2.5,所以 f=0.5 第二个四分位数=第二个值+0.75*(第三个值-第二个值)=4+0.5*(13-4)=8.53.第三个四分位数: k=(3/4)*(4-1)+1=3.25,所以 f=0.25 第散个四分位数=第三个值+0.75*(第四个值-第三个值)=13+0.25*(35-13)=18.5 4.第四个分位数: k=(4/4)*(4-1)+1=4,所以 f=0 第散个四分位数=第四个值+0.75*(第四个值-第三个值)=35 注意到:其实四分位数当然是最后的那个最大数了。 关于四分位数的说明参考: 1.Find the kth smallest member in the array of values, where: k=(quart/4)*(n-1))+1 If k is not an integer, truncate it but store the fractional portion (f) for use in step 3. And where: quart = value between 0 and 4 depending on which quartile you want to find o n = number of values in the array 2. Find the smallest data point in the array of values that is greater than the kth smallest -- the (k+1)th smallest member. 3. Interpolate between the kth smallest and the (k+1)th smallest values: Output = a[k]+(f*(a[k+1]-a[k])) a[k] = the kth smallest a[k+1] = the k+1th smallest |
2楼 亡者天下 |
挖宝来了 |