vignettes/shs/Readme.md

Forecast SHS price

Plot

readd(data_SHS) %>%
  plot_time_series(date, value, .interactive = interactive)

Divide data to train/ test

readd(splits_SHS) %>%
  tk_time_series_cv_plan() %>%
  plot_time_series_cv_plan(date, value, .interactive = FALSE)

Modeltime Table

readd(models_tbl_SHS)
#> # Modeltime Table
#> # A tibble: 4 x 3
#>   .model_id .model   .model_desc                              
#>       <int> <list>   <chr>                                    
#> 1         1 <fit[+]> ARIMA(0,1,0) WITH DRIFT                  
#> 2         2 <fit[+]> ARIMA(0,1,0) WITH DRIFT W/ XGBOOST ERRORS
#> 3         3 <fit[+]> ETS(M,AD,M)                              
#> 4         4 <fit[+]> PROPHET

Calibration

readd(calibration_tbl_SHS)
#> # Modeltime Table
#> # A tibble: 4 x 5
#>   .model_id .model   .model_desc                               .type .calibration_data
#>       <int> <list>   <chr>                                     <chr> <list>           
#> 1         1 <fit[+]> ARIMA(0,1,0) WITH DRIFT                   Test  <tibble [59 x 4]>
#> 2         2 <fit[+]> ARIMA(0,1,0) WITH DRIFT W/ XGBOOST ERRORS Test  <tibble [59 x 4]>
#> 3         3 <fit[+]> ETS(M,AD,M)                               Test  <tibble [59 x 4]>
#> 4         4 <fit[+]> PROPHET                                   Test  <tibble [59 x 4]>

Forecast (Testing Set)

readd(forecast_tbl_SHS) %>% 
  plot_modeltime_forecast(.legend_max_width = 25, 
                           .interactive      = interactive)
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning -Inf

Accuracy table

readd(accuracy_tbl_SHS)$`_data`
#> # A tibble: 4 x 9
#>   .model_id .model_desc                               .type   mae  mape  mase smape  rmse   rsq
#>       <int> <chr>                                     <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1         1 ARIMA(0,1,0) WITH DRIFT                   Test   6.16 12.4   5.82 13.6   7.43  0.64
#> 2         2 ARIMA(0,1,0) WITH DRIFT W/ XGBOOST ERRORS Test   5.9  12.0   5.58 13.0   7.06  0.64
#> 3         3 ETS(M,AD,M)                               Test   8.29 16.7   7.85 18.9   9.93  0   
#> 4         4 PROPHET                                   Test   3.34  7.12  3.16  7.29  4.21  0.64

Next week forecast

readd(two_week_fc_SHS)
#> # A tibble: 5 x 6
#>   .ticker .index     .value  .low .high .model_desc
#>   <chr>   <date>      <dbl> <dbl> <dbl> <chr>      
#> 1 SHS     2022-01-03   51.5  44.5  58.4 PROPHET    
#> 2 SHS     2022-01-04   51.6  44.6  58.5 PROPHET    
#> 3 SHS     2022-01-05   51.7  44.8  58.7 PROPHET    
#> 4 SHS     2022-01-06   51.9  45.0  58.9 PROPHET    
#> 5 SHS     2022-01-07   52.0  45.1  59.0 PROPHET


nguyenngocbinh/bml_stocks documentation built on March 20, 2022, 7:11 a.m.