Learn R Programming

TSstudio (version 0.1.7)

test_forecast: Visualize of the Fitted and the Forecasted vs the Actual Values

Description

Visualize the fitted values of the training set and the forecast values of the testing set against the actual values of the series

Usage

test_forecast(actual, forecast.obj, train = NULL, test, Ygrid = FALSE,
  Xgrid = FALSE, hover = TRUE)

Arguments

actual

The full time series object (supports "ts", "zoo" and "xts" formats)

forecast.obj

The forecast output of the training set with horizon align to the length of the testing (support forecasted objects from the “forecast” package)

train

Training partition, a subset of the first n observation in the series (not requiredthed)

test

The testing (hold-out) partition

Ygrid

Logic,show the Y axis grid if set to TRUE

Xgrid

Logic,show the X axis grid if set to TRUE

hover

If TRUE add tooltip with information about the model accuracy

Examples

Run this code
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
test_forecast(actual = USgas, forecast.obj = fc, test = test)
}

Run the code above in your browser using DataLab