為新區域建立時間序列預測
你已經在課程中為都會區建立了銷售預測模型,並在影片中為山區建立了模型。現在來為東南沿海區做一次 middle-out 預測,完成整個州的層級架構吧!你的工作空間裡已經有銷售資料 SEC_total,以及驗證用的 dates_valid 和 SEC_t_v。
本練習屬於課程
用 R 預測產品需求
練習說明
- 為東南沿海區的銷售(
SEC_total)建立時間序列模型。 - 向前預測 22 個值,延伸到 2017 年。
- 使用日期索引
dates_valid,把這個預測轉成xts物件。 - 計算 MAPE。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Build a time series model for the region using auto.arima
SEC_t_model_arima <- ___(___)
# Forecast the time series model
for_SEC_t <- ___(___, h = ___)
# Make into an xts object from the forecast you just made
for_SEC_t_xts <- ___(___$mean, order.by = ___)
# Calculate the MAPE
MAPE <- mape(___, SEC_t_v)
print(MAPE)