tmmed

语法

tmmed(T, X, window)

参数说明和窗口计算规则请参考:tmFunctions

详情

在给定长度(以时间 T 衡量)的滑动窗口内计算 X 元素的中位数。

例子

T = 1 1 1 2 5 6
X = 1 4 NULL -1 NULL 4
m = table(T as t,X as x)
select *, tmmed(t, x, 3) from m
t x tmmed_t
1 1 1
1 4 2.5
1 2.5
2 -1 1
5
6 4 4
T = 2021.01.02 2021.01.02  2021.01.04  2021.01.05 2021.01.07 2021.01.08
X = NULL 4 NULL -1 2 4
m = table(T as t,X as x)
select *, tmmed(t, x, 3d) from m
t x tmmed_t
2021.01.02
2021.01.02 4 4
2021.01.04 4
2021.01.05 -1 -1
2021.01.07 2 0.5
2021.01.08 4 3
select *, tmmed(t, x, 1w) from m
t x tmmed_t
2021.01.02
2021.01.02 4 4
2021.01.04 4
2021.01.05 -1 1.5
2021.01.07 2 2
2021.01.08 4 3

相关函数:mmed, med