<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />你好,
基於為名為 By-group 的列計算移動平均值的概念,有人可以幫我弄清楚如何按多個組來執行此操作。
輸入列稱為 Guest_count。
我的組由 Store_Num、Day_of_the_Year、Hour 組成
我想從 2014 年 1 月到 2014 年 12 月的最後 3 個先前值(每個 Store_Num、Hour、DayOfYear)創建 Guest_count 的移動平均預測。 我有 2014 年 1 月到 2014 年 4 月的實際數據。
有人可以幫助我使用 JMP 公式嗎?
假設您的數據已排序,以下公式將產生您想要的
If(Row() == 1, thecount = 1);
If(:Store_Num == Lag(:Store_Num, 1) & :Day_of_the_Year == Lag(:Day_of_the_Year, 1) & :Hour == Lag(:Hour, 1), thecount = thecount + 1, thecount = 1);
If(thecount >= 3, x = Mean(:Guest_Count, Lag(:Guest_count, 1), Lag(:Guest_Count, 2)), x = .);
X