allows multiple models to be fitted over multiple time series, using models from the 'modeltime' package.

modeltime_multifit(serie, .prop, ...)

Arguments

serie

nested time series.

.prop

series train/test partition ratio.

...

models or workflows to train (model_1, model2, ...).

Value

A list of 2 items. The first component is a tibble with a first column that contains the name of the series, and a second column called "nested_column" that stores the time series, then a column for each model where the trained models or workflows for each series are stored. The last 2 columns, "nested_model" and "calibration", store the "n" trained models for each series and the adjustment metrics on the test partition. The second element is a tibble saved with the name of 'models_accuracy', it allows to visualize the performance of each model for each series according to a set of metrics.

Details

the focus of this function is not related to panel series, it is oriented to multiple individual series. Receiving as the first argument "series" a set of nested series (for example through the nest() function), then specifying a desired train/test partition ratio for series. The final input to the function are the models to be trained, simply by typing the name of the models separated by commas. The function admits as many models as required.

See also

Examples

#> Loading required package: Formula
#> Loading required package: plotmo
#> Loading required package: plotrix
#> Loading required package: TeachingDemos
nested_serie <- tidyr::nest(dplyr::filter(sknifedatar::emae_series, date < '2007-02-01'), nested_column = -sector) ## Models mars <- parsnip::mars(mode = 'regression') %>% parsnip::set_engine('earth') # modeltime_multifit sknifedatar::modeltime_multifit(serie = head(nested_serie,2), .prop = 0.9, mars)
#> Registered S3 method overwritten by 'tune': #> method from #> required_pkgs.model_spec parsnip
#>
#>
#> ── 2 models fitted ♥ ───────────────────────────────────────────────────────────
#> $table_time #> # A tibble: 2 x 5 #> sector nested_column mars nested_model calibration #> <chr> <list> <list> <list> <list> #> 1 Comercio <tibble [37 × 2]> <fit[+]> <model_time [1 × 3]> <model_time [1 × 5]> #> 2 Ensenanza <tibble [37 × 2]> <fit[+]> <model_time [1 × 3]> <model_time [1 × 5]> #> #> $models_accuracy #> # A tibble: 2 x 10 #> name_serie .model_id .model_desc .type mae mape mase smape rmse rsq #> <chr> <int> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Comercio 1 EARTH Test 5.68 4.68 0.876 4.53 6.79 0.240 #> 2 Ensenanza 1 EARTH Test 2.92 2.58 1.94 2.54 3.45 0.0651 #>