R - 如何按组预测具有多个变量的每日时间序列
R - How to forecast by group for a daily time series with multiple variables
我不熟悉按组进行时间序列预测。
我有一个大型的每日时间序列数据集,我需要对其进行预测。
我用谷歌搜索了很多,尝试了很多不同的方法,但都没有成功。
date country device os browser visits clicks logins sale
7/29/2018 USA desktop Windows Firefox 3046 1523 762 381
7/29/2018 USA mobile Windows Firefox 6546 3273 1637 818
7/29/2018 USA tablet Windows Firefox 864 432 216 108
7/30/2018 USA desktop Windows Firefox 11004 5502 2751 1376
7/30/2018 USA mobile Windows Firefox 7938 3969 1985 992
7/30/2018 USA tablet Windows Firefox 1114 557 279 139
7/31/2018 USA desktop Windows Firefox 10814 5407 2704 1352
7/31/2018 USA mobile Windows Firefox 7560 3780 1890 945
7/31/2018 USA tablet Windows Firefox 984 492 246 123
这是我生成的示例数据集,因为我找不到任何其他可以正确表示我的问题的开放数据集。 (如果样本数量不好,我们深表歉意)
我希望通过 'country','country','logins','sales' 预测此数据集接下来 'n' 天的每日“访问量” =28=]、'os' 和 'browser'
如有任何帮助,我们将不胜感激。
这正是我们正在开发 tsibble
和 fable
包的用例。 tsibble
在 CRAN 上(https://cran.r-project.org/package=tsibble), while fable
is still only on github (https://github.com/tidyverts/fable)。
您可以通过 country
、device
、os
和 browser
:
来预测 clicks
library(tsibble)
library(fable)
mydata <- tsibble(dataframe, key = c(country, device, os, browser), index=date)
mydata %>%
model(ETS(clicks)) %>%
forecast()
我不熟悉按组进行时间序列预测。
我有一个大型的每日时间序列数据集,我需要对其进行预测。
我用谷歌搜索了很多,尝试了很多不同的方法,但都没有成功。
date country device os browser visits clicks logins sale
7/29/2018 USA desktop Windows Firefox 3046 1523 762 381
7/29/2018 USA mobile Windows Firefox 6546 3273 1637 818
7/29/2018 USA tablet Windows Firefox 864 432 216 108
7/30/2018 USA desktop Windows Firefox 11004 5502 2751 1376
7/30/2018 USA mobile Windows Firefox 7938 3969 1985 992
7/30/2018 USA tablet Windows Firefox 1114 557 279 139
7/31/2018 USA desktop Windows Firefox 10814 5407 2704 1352
7/31/2018 USA mobile Windows Firefox 7560 3780 1890 945
7/31/2018 USA tablet Windows Firefox 984 492 246 123
这是我生成的示例数据集,因为我找不到任何其他可以正确表示我的问题的开放数据集。 (如果样本数量不好,我们深表歉意)
我希望通过 'country','country','logins','sales' 预测此数据集接下来 'n' 天的每日“访问量” =28=]、'os' 和 'browser'
如有任何帮助,我们将不胜感激。
这正是我们正在开发 tsibble
和 fable
包的用例。 tsibble
在 CRAN 上(https://cran.r-project.org/package=tsibble), while fable
is still only on github (https://github.com/tidyverts/fable)。
您可以通过 country
、device
、os
和 browser
:
clicks
library(tsibble)
library(fable)
mydata <- tsibble(dataframe, key = c(country, device, os, browser), index=date)
mydata %>%
model(ETS(clicks)) %>%
forecast()