<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