modl {predtoolsTS} | R Documentation |
Building predictive models
Description
This function give us the tools to build predictive models for time series.
Usage
modl(tserie, method = "arima", algorithm = NULL, formula = NULL,
initialWindow = NULL, horizon = NULL, fixedWindow = NULL)
Arguments
tserie |
A ts or prep object. |
method |
A string. Current methods available are "arima" and "dataMining". Method "arima" is set as default. |
algorithm |
A string. In case |
formula |
An integer vector. Contains the indexes from the time series wich will indicate how to extract the features. The last value will be the class index. Default value: c(1:16) |
initialWindow |
An integer. The initial number of consecutive values in each training set sample. Default value: 30. |
horizon |
An integer. The number of consecutive values in test set sample. Default value: 15. |
fixedWindow |
A logical: if FALSE, the training set always start at the first sample and the training set size will vary over data splits. Default value: TRUE. |
Details
Returns an object modl
which stores all the information related to
the final chosen model (errors, parameters, model).
Currently this function covers two different methods: the widely know ARIMA
and the "not so used for prediction" data mining. For the data mining we make
use of the caret
package.
The caret
package offers plenty of data mining algorithms.
For the data splitting here we use a rolling forecasting origin technique, wich
works better on time series.
Value
A list is returned of class modl
containing:
tserie |
Original time serie. |
tserieDF |
Time serie converted to data frame. |
method |
Method used to build the model. |
algorithm |
If method is data mining, indicates wich algorithm was used. |
horizon |
Horizon for the splitting. |
model |
Model result from |
errors |
Contains three different metrics to evaluate the model. |
Author(s)
Alberto Vico Moreno
References
http://topepo.github.io/caret/index.html
See Also
prep
modl.arima
,
modl.tsToDataFrame
,
modl.trControl
,
modl.dataMining
Examples
p <- prep(AirPassengers)
modl(p,method='arima')
modl(p,method='dataMining',algorithm='rpart')