Description Usage Arguments Details Value Examples
Initialises a validatr object.
1 2 |
data |
data frame containing variables for modelling. |
y |
dependent variable name. Non-standard evaluation. |
k |
integer. Number of folds. |
ts |
time-series variable name. Non-standard evaluation. |
start |
numeric, date or POSIX object specifying the start date for time-series validation folds. |
horizon |
forecast horizon to evaluate. |
shift |
length of time to move forward for each new fold. |
The type of data being tested influences how the validatr and it's methods respond. The following types are supported:
regression regression data (default).
ts time-series data (ts argument specified).
classification classification data (y variable character, factor or
logical).
The type of cross-validation and accuracy measures to be calculated are
influenced by this parameter. For regression, k-fold cross-validation is
carried out and requires the number of folds k to be specified. Leave one
out cross-validation can easily be accomplished by setting k equal to the
number of observations.
For time-series, time-series cross-validation takes place. This requires the
start, horizon, shift and ts arguments to be specified:
start is the start of the first fold.
horizon is the length of the fold.
shift is the length of time to move forward.
ts is the name of the variable containing time-series data.
If start is numeric, then horizon and shift are also numeric. If
start is date or POSIX, then horizon and shift follow the same
convention as for seq.Date and seq.POSIXt. Hence, they are a character
string, containing one of "sec", "min", "hour", "day", "DSTday", "week",
"month", "quarter" or "year".
Finally, classification carries out k-fold cross validation as well, but its accruacy measures will be different to regression.
validatr returns an initial validatr object. This object contains cross
validation folds and validation parameters.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.