auto_arima_cv: Cross Validation Auto ARIMA

Description Usage Arguments Details Value See Also Examples

View source: R/auto_arima_cv.R

Description

This function finds the ARIMA model that minimizes average RMSE via grid search and time-series cross validation. All cominations of (p, d, q) and (P, D, Q) terms are considered, as well as the inclusion of exogenous regressors.

Usage

1
2
3
4
5
6
auto_arima_cv(y, x = NULL, p = 2, d = 1, q = 2, P = 1, D = 1,
  Q = 1, period = NA, max_parameters = NULL,
  initialWindow = as.integer(0.7 * length(y)), horizon = 1,
  fixedWindow = T, skip = 0, include.mean = TRUE,
  transform.pars = TRUE, fixed = NULL, init = NULL,
  method = c("CSS-ML", "ML", "CSS"))

Arguments

y

A numeric vector

x

A numeric matrix of dimension n,k where n is the length of y and k is the number of potential regressors

p

Max AR order

d

Max degree of differencing

q

Max MA order

P

Max seasonal AR order, defaults to 0 if period is NA

D

Max seasonal degree of differencing, defaults to 0 if period is NA

Q

Max seasonal MA order, defaults to 0 if period is NA

period

Frequency of the time series

max_parameters

Max sum of AR, MA, seasonal AR, seasonal MA, and k

initialWindow

The initial number of consecutive values in each training set sample, defaults to 70% of length(y)

horizon

The number of consecutive values in test set sample

fixedWindow

Logical, if FALSE, all training samples start at 1

skip

Integer, how many (if any) resamples to skip to thin the total amount

include.mean

Should the ARMA model include a mean/intercept term? The default is TRUE for undifferenced series, and it is ignored for ARIMA models with differencing.

transform.pars

Logical; if true, the AR parameters are transformed to ensure that they remain in the region of stationarity. Not used for method = "CSS". For method = "ML", it has been advantageous to set transform.pars = FALSE in some cases, see also fixed.

fixed

Optional numeric vector of the same length as the total number of parameters. If supplied, only NA entries in fixed will be varied. transform.pars = TRUE will be overridden (with a warning) if any AR parameters are fixed. It may be wise to set transform.pars = FALSE when fixing MA parameters, especially near non-invertibility.

method

Fitting method: maximum likelihood or minimize conditional sum-of-squares. The default (unless there are missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood. Can be abbreviated.

Optional

numeric vector of initial parameter values. Missing values will be filled in, by zeroes except for regression coefficients. Values already specified in fixed will be ignored.

Details

  1. If a parallel backend is registered, this function runs in parallel via %dopar%.

  2. If a model does not converge it does not appear in the average RMSE calculation.

Value

A list containing the following:

See Also

arima, auto.arima

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
D <- ts(matrix(rnorm(150), ncol = 3))
y <- D[-1,1]
x <- D[-nrow(D),-1]
# x variables are lagged by 1, with NAs removed

doParallel::registerDoParallel() # setup parallel backend

model <- auto_arima_cv(y = y)

foreach::registerDoSEQ() # return to sequential processing

joshua-ruf/fidelis documentation built on July 20, 2019, 1:56 a.m.