開始使用免費開始

從迴歸計算殘差

你先前的模型會用價格的對數、節日與促銷效果來預測銷售量的對數,並已儲存在物件 model_MET_hi_full 中。用來建立此模型的資料框在物件 MET_hi_train。現在來看看有哪些地方沒預測好。

本練習屬於課程

用 R 預測產品需求

檢視課程

練習說明

  • 計算模型 model_MET_hi_full 的殘差,並存成 MET_hi_full_res
  • 將這些殘差轉換成 xts 物件。記得你的日期索引存在 dates_train

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Calculate the residuals from the model
MET_hi_full_res <- ___(___)

# Convert the residuals to an xts object
MET_hi_full_res <- xts(___, order.by = ___)
編輯並執行程式碼