if (FALSE) {
library(forecast)
data(USgas)
# Set the horizon of the forecast
h <- 12
# split to training/testing partition
split_ts <- ts_split(USgas, sample.out = h)
train <- split_ts$train
test <- split_ts$test
# Create forecast object
fc <- forecast(auto.arima(train, lambda = BoxCox.lambda(train)), h = h)
# Plot the fitted and forecasted vs the actual values
res_hist(forecast.obj = fc)
}
Run the code above in your browser using DataLab