tmskewTopN

Syntax

tmskewTopN(T, X, S, window, top, [biased=true], [ascending=true], [tiesMethod='latest'])

Arguments

biased (optional) is a Boolean value indicating whether the result is biased. The default value is true, meaning the bias is not corrected.

Please see tmTopN for the parameters and windowing logic.

Details

Within a sliding window of given length (measured by time), the function stably sorts X by S in the order specified by ascending, then calculates the moving skewness of the first top elements.

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
tmskewTopN(T,X,S,6,4)
// output
[,0,0.3818,0.3818,-0.2138,-0.4933,-0.8164]

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 tmskewTopN(time,val,id,4,3) as topN from t
topN
0
0
0.5280
0.7071

Related function: tmskew