Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

std、mstd如何通过参数变成有偏,类似pandas、numpy的std(ddof=1 or 0)

DolphinDB中的std函数可以计算标准差,mstd函数可以计算在长度为window的滑动窗口中的移动标准差,那么请问,DolphinDB中std、mstd如何通过参数变成有偏标准差?有点类似pandas、numpy的std(ddof=1 or 0) 。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

std函数可以计算标准差,可以通过以下代码计算有偏标准差,其中n是向量x的元素个数:

std(x)*sqrt((n-1.0)/n)

mstd函数可以计算在长度为window的滑动窗口中的移动标准差,可以通过以下代码计算有偏标准差,其中n是向量x的元素个数:

def pstd(x, n){
    counts = mcount(x, n)
    return mstd(x, n) * sqrt((counts - 1.0)/counts)
}
pstd(x, n)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...