-
Notifications
You must be signed in to change notification settings - Fork 65
test_forecast example
Rami Krispin edited this page Jul 26, 2018
·
2 revisions
Example of the test_forecast function usage
library(TSstudio)
library(forecast)
data(USgas)
ts_plot(USgas)
h = 24
USgas_split <- ts_split(USgas, sample.out = h)
train <- USgas_split$train
test <- USgas_split$test
md1 <- auto.arima(train) # ARIMA model
md2 <- ets(train) # ETS model
md3 <- nnetar(train, p = 12, P = 2) # Neural Network for time series
fc1 <- forecast(md1, h = h)
fc2 <- forecast(md2, h = h)
fc3 <- forecast(md3, h = h)
test_forecast(actual = USgas, forecast.obj = fc1, test = test)
test_forecast(actual = USgas, forecast.obj = fc2, test = test)
test_forecast(actual = USgas, forecast.obj = fc3, test = test)