ETS 什麼時候會失靈?
對所有時間序列來說,使用 ETS 並不一定理想。
在這裡,你會看到它為什麼不適合用在年度的加拿大猞猁(Canadian lynx)族群數,該資料已在你的工作環境中,物件名稱為 lynx。
本練習屬於課程
R 的時間序列預測
練習說明
- 使用標準繪圖函式繪製
lynx序列,並留意其中的循環行為。 - 使用
ets()建立lynx的模型,並指定給fit。 - 使用
summary()檢視所選模型與其參數。 - 使用管線運算子繪製未來 20 年的預測。注意,你只需要在其中一個函式上指定
h。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Plot the lynx series
___
# Use ets() to model the lynx series
fit <- ___
# Use summary() to look at model and parameters
___
# Plot 20-year forecasts of the lynx series
fit %>% ___ %>% ___