Produces forecasts from a trained model.
# S3 method for class 'croston'
forecast(object, new_data, specials = NULL, ...)
A model for which forecasts are required.
A tsibble containing the time points and exogenous regressors to produce forecasts for.
(passed by fabletools::forecast.mdl_df()
).
Other arguments passed to methods
A list of forecasts.
library(tsibble)
sim_poisson <- tsibble(
time = yearmonth("2012 Dec") + seq_len(24),
count = rpois(24, lambda = 0.3),
index = time
)
sim_poisson %>%
model(CROSTON(count)) %>%
forecast()
#> # A fable: 24 x 4 [1M]
#> # Key: .model [1]
#> .model time count .mean
#> <chr> <mth> <dist> <dbl>
#> 1 CROSTON(count) 2015 Jan 0.3809524 0.381
#> 2 CROSTON(count) 2015 Feb 0.3809524 0.381
#> 3 CROSTON(count) 2015 Mar 0.3809524 0.381
#> 4 CROSTON(count) 2015 Apr 0.3809524 0.381
#> 5 CROSTON(count) 2015 May 0.3809524 0.381
#> 6 CROSTON(count) 2015 Jun 0.3809524 0.381
#> 7 CROSTON(count) 2015 Jul 0.3809524 0.381
#> 8 CROSTON(count) 2015 Aug 0.3809524 0.381
#> 9 CROSTON(count) 2015 Sep 0.3809524 0.381
#> 10 CROSTON(count) 2015 Oct 0.3809524 0.381
#> # ℹ 14 more rows