tmstdpTopN
Syntax
tmstdpTopN(T, X, S, window, top, [ascending=true], [tiesMethod=’latest’])
Please see Time-Based Moving TopN Functions (tmTopN functions) for the parameters and windowing logic.
Details
After stably sorting S in the specified ascending order, the function calculates the population standard deviation of the first top elements of X in a sliding window.
Return value: a vector of DOUBLE type
Examples
$ T=2023.01.03+1..7
$ X = [2, 1, 4, 3, 4, 3, 1]
$ S = [5, 8, 1, , 1, 1, 3]
// The NULL values in S are ignored in data sorting, and the corresponding elements in X do not participate in calculation
$ tmstdpTopN(T,X,S,6,4)
[0,0.5,1.2472,1.2472,1.299,0.8291,1.2247]
$ T=2023.01.03 2023.01.07 2023.01.08 2023.01.10 2023.01.11 2023.01.12
$ X=8 3 1 2 5 2
$ S=1 5 2 3 1 1
$ t=table(T as time, X as val, S as id)
$ select tmstdpTopN(time,val,id,4,3) as topN from t
topN |
---|
0 |
0 |
1 |
0.8164 |
1.6996 |
1.4142 |
Related function: tmstdp