Time Series Forecasting Techniques
Instruction: Describe various time series forecasting techniques in R and their applications.
Context: This question assesses the candidate's knowledge of time series analysis and forecasting methods in R, critical for analyzing temporal data.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Begin with a naive or seasonal-naive baseline and a forecast horizon matching the decision. Use rolling-origin evaluation so each forecast uses only information available at its origin.
library(forecast) y <- ts(10 + .1 * (1:48) + rep(c(-2, 0, 3, 1), 12), frequency = 4) train <- window(y, end = c(10, 4)) test <- window(y, start = c(11, 1)) baseline <- snaive(train, h = length(test)) fit <-...