Description Usage Arguments Details Value Note Examples
Creates an ARIMA model that is then fitted to the data as a univariate time series. If further variables are specified in the model, it also includess exogenous variables. The order (p, d, q) is fixed as specified.
1 | arima_model(p, d, q, intercept = TRUE, ...)
|
p |
Order of auto-regressive (AR) terms. |
d |
Degree of differencing. |
q |
Order of moving-average (MA) terms. |
intercept |
Boolean value whether to include an intercept term (default:
|
... |
Further arguments used when fitting ARIMA model. |
Variable importance metrics return the absolute value of the coefficients for the exogenous variables (if any).
Model definition that can then be insered into train
.
If one desires an auto-tuning of the best order, then one needs to switch to
auto_arima_model
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | library(caret)
# without exogenous variables
library(forecast)
data(WWWusage) # from package "forecast"
lm <- train(WWWusage, method = "lm", trControl = trainDirectFit())
summary(lm)
arima <- train(WWWusage, method = arima_model(1, 1, 1), trControl = trainDirectFit())
summary(arima)
# with exogenous variables
library(vars)
data(Canada)
arima <- train(x = Canada[, -2], y = Canada[, 2],
method = arima_model(2, 0, 0), trControl = trainDirectFit())
summary(arima)
arimaorder(arima$finalModel) # order of best model
predict(arima, Canada[, -2]) # in-sample predictions
RMSE(predict(arima, Canada[, -2]), Canada[, 2]) # in-sample RMSE
absCoef <- varImp(arima, scale = FALSE) # variable importance (= absolute value of coefficient)
absCoef
plot(absCoef)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.