时间序列交叉验证

R 中的预测

Rob J. Hyndman

Professor of Statistics at Monash University

时间序列交叉验证

ch2_vid4_slides.002.png

R 中的预测

时间序列交叉验证

ch2_vid4_slides.003.png

R 中的预测

时间序列交叉验证

ch2_vid4_slides.004.png

R 中的预测

时间序列交叉验证

ch2_vid4_slides.005.png

R 中的预测

tsCV 函数

使用时间序列交叉验证的 MSE

e <- tsCV (oil, forecastfunction = naive, h = 1)
mean(e^2 , na.rm = TRUE)
2355.753

当无需估计参数时,h=1 的 tsCV 将与残差给出相同数值

R 中的预测

tsCV 函数

  sq <- function(u){u^2}
  tsCV(oil, forecastfunction = naive, h = 10) %>%
    sq() %>% colMeans(na.rm=TRUE)
      h=1       h=2       h=3       h=4       h=5       h=6
 2355.753  5734.838  9842.239 14299.997 18560.887 23264.410
      h=7       h=8       h=9      h=10
26932.799 30766.136 32892.200 32986.214

MSE 随预测步长增加而上升

R 中的预测

tsCV 函数

  • 使用时间序列交叉验证计算的 MSE 最小的模型
  • 在您最关心的预测步长处计算
R 中的预测

让我们来练习!

R 中的预测

Preparing Video For Download...