利用S>quantile(S,0.8)和aggrTopN( sortingCol=S,top=0.2, ascending=false)筛选出来的结果为什么会不一样?

select SecurityID,TradeDate,aggrTopN(func=abs, funcArgs=CLOSE, sortingCol=CLOSE, top=0.20, ascending=false) as res from  data   group by SecurityID

defg compute_part(CLOSE)
{
index = at(CLOSE>quantile(CLOSE,0.8))
return abs(CLOSE[index])
}
select SecurityID,TradeDate,computer(CLOSE) as res from  data   group by SecurityID

结果为什么会不一样?

请先 登录 后评论

1 个回答

banxianer

如图所示,由于百分位数确定的方式默认是通过线性拟合再代入0.8分位点得到的结果,因此通过S>quantile(S,0.8)筛选出来的数据数量并不确定。

attachments-2022-04-Bz536bpZ62577d8633530.jpg

请先 登录 后评论