【问题标题】:Converting multivariate dataframe to univariate time series using R使用 R 将多变量数据帧转换为单变量时间序列
【发布时间】:2018-01-03 23:37:14
【问题描述】:

这些是我正在使用的数据集的头部。

 Hour count
  <chr> <int>
1    00 22462
2    01 13293
3    02 10595
4    03  9371
5    04 14325
6    05 38598

要使用自动 arima 执行预测,我应该将此数据转换为单变量。

make.univ(rsms,sms.hour,tname="TIME1", outname="MULTDV")

我使用上面的代码转换为单变量,但它给出了错误。

data.frame 中的错误(timedat = rep(0:(NREPOBS - 1), nrow(x)), outdat = as.vector(t(dvs))) :参数意味着不同的行数: 4123938, 48

原始数据集:

rsms [2million records(1 day data)] sample dataset : sms.hour[24
records (class(sms.hour) = "tbl_df"     "tbl"        "data.frame"]

有人可以帮我解决这个问题吗?

【问题讨论】:

  • 尝试使用auto.arima(rsms$count)
  • 感谢它帮助了我。但它不会生成最佳预测模型。有什么方法可以增强 arima 模型吗?

标签: r time-series data-mining arima


【解决方案1】:

您的数据已经是单变量的。我不确定,但我认为以下几行会使您的数据看起来像 make.univ() 调用的输出:

rsms$Hour <- as.numeric(rsms$Hour)
names(rsms) <- c("TIME", "MULTDV")

【讨论】:

  • 但是当我执行 auto.arima 函数 > auto.arima(sms.hour) {Auto.arima(sms.hour) 中的错误:auto.arima 只能处理单变量时间序列}... ......它会产生一个错误。:-(
猜你喜欢
  • 1970-01-01
  • 2021-09-01
  • 1970-01-01
  • 2018-02-08
  • 2020-03-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多