根据Matlab 的帮助,quantile
在经验累积分布函数 (ECDF) 上的点之间进行线性插值。重要的是,在每一步之间插值的点是立管的中点。我发现实际行为有很大不同。这是我的示例,ECDF,以及显示插值的线段:
y= [ 1 2 5 5 5 5 5 5 9 10 ]
ecdf(y)
grid on
set(get(gca,'Children'),'LineWidth',2)
hold on
% Line segment for interpolation
x2points=[2;5]; y2points=[0.15;0.5];
plot(x2points,y2points)
从插值线段,我们预计 F(x)=0.3 的分位数在 x=3.3 左右,但实际上是 x=5。
yInterior=0.3 % Value to get `x` for
xInterior=interp1(y2points,x2points,yInterior) % ans = 3.2857
xInterior=quantile(y,yInterior) % ans x=5
我在其他地方是否还缺少其他文档来解释这种差异?
我是唯一一个看到这个的吗?
我正在使用 Matlab 2015b。