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.1176471 0.118
#> 2 CROSTON(count) 2015 Feb 0.1176471 0.118
#> 3 CROSTON(count) 2015 Mar 0.1176471 0.118
#> 4 CROSTON(count) 2015 Apr 0.1176471 0.118
#> 5 CROSTON(count) 2015 May 0.1176471 0.118
#> 6 CROSTON(count) 2015 Jun 0.1176471 0.118
#> 7 CROSTON(count) 2015 Jul 0.1176471 0.118
#> 8 CROSTON(count) 2015 Aug 0.1176471 0.118
#> 9 CROSTON(count) 2015 Sep 0.1176471 0.118
#> 10 CROSTON(count) 2015 Oct 0.1176471 0.118
#> # ℹ 14 more rows