mstdTopN
语法
mstdTopN(X, S, window, top, [ascending=true],
[tiesMethod='oldest'])
参数说明和窗口计算规则请参考:mTopN
详情
在给定长度(以元素个数衡量)的滑动窗口内,根据 ascending 指定的排序方式将 X 按照 S 进行稳定排序后,取前 top 个元素计算样本标准差。
例子
X = 1..7
S = 0.3 0.5 0.1 0.1 0.5 0.2 0.4
mstdTopN(X, S, 4, 2)
# output
[,0.707106781186548,1.414213562373095,0.707106781186548,0.707106781186548,0.707106781186548,1.414213562373095]
X = NULL 1 2 3 4 NULL 5
S = 3 5 1 1 5 2 4
mstdTopN(X, S, 4, 2)
# output
[,,,0.707106781186548,0.707106781186548,0.707106781186548,]
X = matrix(1..5, 6..10)
S = 2022.01.01 2022.02.03 2022.01.23 2022.04.06 2021.12.29
mstdTopN(X, S, 3, 2)
#0 | #1 |
---|---|
0.707106781186548 | 0.707106781186548 |
1.414213562373095 | 1.414213562373095 |
0.707106781186548 | 0.707106781186548 |
1.414213562373095 | 1.414213562373095 |
X = matrix(1..5, 6..10)
S = matrix(2022.01.01 2022.02.03 2022.01.23 NULL 2021.12.29,NULL 2022.02.03 2022.01.23 2022.04.06 NULL)
mstdTopN(X, S, 3, 2)
#0 | #1 |
---|---|
0.7071 | |
1.4142 | 0.7071 |
0.7071 | 0.7071 |
1.4142 | 0.7071 |
相关函数:mstd