Extracts the residuals.

# S3 method for class 'TSLM'
residuals(object, ...)

Arguments

object

A model for which forecasts are required.

...

Other arguments passed to methods

Value

A vector of fitted residuals.

Examples

as_tsibble(USAccDeaths) %>%
  model(lm = TSLM(log(value) ~ trend() + season())) %>%
  residuals()
#> # A tsibble: 72 x 3 [1M]
#> # Key:       .model [1]
#>    .model    index .resid
#>    <chr>     <mth>  <dbl>
#>  1 lm     1973 Jan 0.0759
#>  2 lm     1973 Feb 0.0699
#>  3 lm     1973 Mar 0.0646
#>  4 lm     1973 Apr 0.0616
#>  5 lm     1973 May 0.0559
#>  6 lm     1973 Jun 0.0838
#>  7 lm     1973 Jul 0.0416
#>  8 lm     1973 Aug 0.0598
#>  9 lm     1973 Sep 0.0735
#> 10 lm     1973 Oct 0.0630
#> # ℹ 62 more rows