你好
給定一個包含數值的列,我想以這種方式計算 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 ) ) )
);
乾杯,馬西莫