移动最小值(移动窗口)有谁知道如何计算移动最小值(或者如何迭代地选择 X 个滞后行并对它们执行任何操作,例如计算最小值、最大值、范围等。在这个特定的例子中,我想回顾最后 100 行并获取最小值,然后移动到下一行并再次执行相同操作(一遍又一遍)。
实验设计回复:最小移动(移动窗口)下面的宏并不是特别优雅,但是可以完成工作。
For ( i= 100, i <= N Rows ( dt ), i++,
dt << Select Rows (Index (i-99, i));
dt << Subset(
Selected Rows( 1 ),
Selected Columns ( 0 ),
Output Table ("out")
);
Current Data Table ( Data Table ("out"));
x = Col Minimum ( :YourDataColumn );
Close ( Data Table ( "out"), no save);
Column ( "YourMovingWindow" )[i] = x;
)子设置所选数据(我已经完成了)很慢。也许另一个用户对如何访问所选数据并提取所需产品有更好的主意。
我还想知道,没有宏,列公式将如何实现结果。
干杯,
科菲
回复:最小移动(移动窗口)这样的事情行吗?
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dt << New Column("Min height 5 back",
Formula(
Min( // since we want a minumum
:height[// the column we want the minimum of
// a slice of the current row minus 5 (minimum 1 so it's still on the datatable)
// and current row
Min( Row() - 5 )::Row()
]
)
)
);