Produces forecasts from a trained model.

# S3 method for croston
forecast(object, new_data, specials = NULL, ...)

Arguments

object

A model for which forecasts are required.

new_data

A tsibble containing the time points and exogenous regressors to produce forecasts for.

specials

(passed by fabletools::forecast.mdl_df()).

...

Other arguments passed to methods

Value

A list of forecasts.

Examples

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