Description Usage Arguments Value Examples
Extends the train
function from the "caret" package to support
time series objects.
1 2 | ## S3 method for class 'ts'
train(x, ...)
|
x |
Object of class |
... |
Further arguments passed on to |
Trained 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 | library(caret)
library(forecast)
data(WWWusage)
class(WWWusage)
str(WWWusage)
arima <- train(WWWusage, method = auto_arima_model(), trControl = trainDirectFit())
summary(arima)
arimaorder(arima$finalModel) # order of best model
RMSE(predict(arima, WWWusage), WWWusage) # in-sample RMSE
library(vars)
data(Canada)
class(Canada)
str(Canada)
arima <- train(x = Canada[, -2], y = Canada[, 2],
method = auto_arima_model(), trControl = trainDirectFit())
summary(arima)
arimaorder(arima$finalModel) # order of best model
RMSE(predict(arima, Canada[, -2]), Canada[, 2]) # in-sample RMSE
arima <- train(form = prod ~ ., data = Canada,
method = auto_arima_model(), trControl = trainDirectFit())
summary(arima)
arimaorder(arima$finalModel) # order of best model
RMSE(predict(arima, Canada), Canada[, "prod"]) # in-sample RMSE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.