Learn R Programming

iForecast (version 1.1.1)

tts.var: Estimate Vector AutoregRessive model by tts.caret

Description

It estimate VAR model by tts.caret, and generates an object list for multistep forecasts.

Usage

tts.var(
  data,
  p,
  method,
  train.end,
  type,
  trace=TRUE)

Value

output

Output list object generated.

method

The method used.

type

Type of time dummies used, inherited from type of tts.var

data

The complete data structure

Arguments

data

The time series object of the VAR dataset, for example, timeSeries,xts, or zoo. y can be either binary or continuous. Date format must be "

p

The lag order as in VAR(p).

method

The train_model_list of caret. While using this, make sure that the method allows regression. Methods in c("svm","rf","rpart","gamboost","BstLm","bstSm","blackboost") are feasible.

train.end

The end date of training data, must be specificed.The default dates of train.start and test.end are the start and the end of input data; and the test.start is the 1-period next of train.end.

type

The time dummies variables. We have four selection:
"none"=no other variables,
"trend"=inclusion of time dummy,
"season"=inclusion of seasonal dummies,
"both"=inclusion of both trend and season. No default.

trace

Whether to print the looping information. The defaut is TRUE.

Author

Ho Tsung-wu <tsungwu@ntnu.edu.tw>, College of Management, National Taiwan Normal University.

Details

This function calls tts.caret of package to execute VAR estimation.

Examples

Run this code
data(macrodata)
y=timeSeries::as.timeSeries(macrodata[,-1])
VLD=window(y,start="2019-01-01",end=end(y))
#OUT1=tts.var(data=y,
#             p=3,
#             method="enet",
#             train.end="2018-12-01",
#             type=c("none","trend","season","both")[1])

#fcst_ml=iForecast.var(OUT1, n.ahead=nrow(VLD))

Run the code above in your browser using DataLab