Extracts the residuals.
# S3 method for class 'croston'
residuals(object, ...)
A vector of fitted residuals.
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 NA
#> 3 CROSTON(count) 2013 Mar NA
#> 4 CROSTON(count) 2013 Apr NA
#> 5 CROSTON(count) 2013 May -0.300
#> 6 CROSTON(count) 2013 Jun -0.300
#> 7 CROSTON(count) 2013 Jul -0.300
#> 8 CROSTON(count) 2013 Aug 0.700
#> 9 CROSTON(count) 2013 Sep 0.700
#> 10 CROSTON(count) 2013 Oct -0.300
#> # ℹ 14 more rows