Extracts the residuals.

# S3 method for croston
residuals(object, ...)

Arguments

object

A model for which forecasts are required.

...

Other arguments passed to methods

Value

A vector of fitted residuals.

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)) %>%
  residuals()
#> # A tsibble: 24 x 3 [1M]
#> # Key:       .model [1]
#>    .model             time .resid
#>    <chr>             <mth>  <dbl>
#>  1 CROSTON(count) 2013 Jan NA    
#>  2 CROSTON(count) 2013 Feb -0.336
#>  3 CROSTON(count) 2013 Mar -0.336
#>  4 CROSTON(count) 2013 Apr -0.336
#>  5 CROSTON(count) 2013 May -0.336
#>  6 CROSTON(count) 2013 Jun  1.66 
#>  7 CROSTON(count) 2013 Jul -0.396
#>  8 CROSTON(count) 2013 Aug -0.396
#>  9 CROSTON(count) 2013 Sep  0.604
#> 10 CROSTON(count) 2013 Oct  0.582
#> # ℹ 14 more rows