Extracts the residuals.

# S3 method for class 'AR'
residuals(object, type = c("innovation", "regression"), ...)

Arguments

object

A model for which forecasts are required.

type

The type of residuals to extract.

...

Other arguments passed to methods

Value

A vector of fitted residuals.

Examples

as_tsibble(lh) %>%
  model(AR(value ~ order(3))) %>%
  residuals()
#> # A tsibble: 48 x 3 [1]
#> # Key:       .model [1]
#>    .model               index  .resid
#>    <chr>                <dbl>   <dbl>
#>  1 AR(value ~ order(3))     1 NA     
#>  2 AR(value ~ order(3))     2 NA     
#>  3 AR(value ~ order(3))     3 NA     
#>  4 AR(value ~ order(3))     4 -0.195 
#>  5 AR(value ~ order(3))     5 -0.163 
#>  6 AR(value ~ order(3))     6 -0.711 
#>  7 AR(value ~ order(3))     7  0.431 
#>  8 AR(value ~ order(3))     8 -0.159 
#>  9 AR(value ~ order(3))     9 -0.0469
#> 10 AR(value ~ order(3))    10 -0.491 
#> # ℹ 38 more rows