你好
给定一个包含数值的列,我想以这种方式计算 MA:
MAi=1/N*SUM(j=i-1 到 j=iw) Xj
其中 w 是窗口宽度,i-1 是起始元素,iw 是最后一个元素。 不做一个 w=2 的例子
tx
-------------
1×1
2×2
3 x 3 ……
4 x4 MA=(X3+X2)/2
5 x5 MA=(X4+X3)/2
6 x 6 ……
7×7
通过使用新公式列-->行功能
我将权重设置为“等于”。 获取我之前报告的内容的“之前的项目”和“之后的项目”怎么样?
如果我想使用指数权重,同样的问题。

谢谢菲利斯
啊,抱歉我错过了这个细节。您可以在 Col 移动平均线周围添加滞后公式来实现此目的:

对于你的例子:
New Table( "MA Example",
Add Rows( 10 ),
New Column( "Data",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] )
),
New Column( "MA",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Lag( Col Moving Average( :Data, 1, 2, 0 ) ) )
)
)
给出预期结果:

让我举个例子
假设有序列 1 2 3 4 5 6 7 8 9
从 5 开始,我想计算前 w 行的平均值。 对于w=3
(2+3+4)/3
并不是
(3+4+5)/3
费利斯
你好,
如果它是简单的移动平均线,您可以使用公式编辑器中的 Lag() 函数轻松计算它。
以下示例介绍了如何计算片剂生产示例数据表中溶出度列前 3 行的移动平均值:
// Open Data Table: Tablet Production.jmp
// → Data Table( "Tablet Production" )
Open( "$SAMPLE_DATA/Tablet Production.jmp" );
// New column: Dissolution_MA3
Data Table( "Tablet Production" ) << New Column( "Dissolution_MA3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
(Lag( :Dissolution, 1 ) + Lag( :Dissolution, 2 ) + Lag( :Dissolution, 3 ))
/ 3
)
);
// Report snapshot: Tablet Production - Graph Builder
Data Table( "Tablet Production" ) << Graph Builder(
Size( 799, 452 ),
Show Control Panel( 0 ),
Variables( Y( :Dissolution ), Y( :Dissolution_MA3, Position( 1 ) ) ),
Elements( Line( Y( 1 ), Y( 2 ), Legend( 6 ), Row order( 1 ) ) )
);
干杯,马西莫