Extracts the residuals.

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

Arguments

object

The time series model used to produce the forecasts

...

Additional arguments for forecast model methods.

Value

A vector of fitted residuals.

Examples

lung_deaths <- cbind(mdeaths, fdeaths) %>% as_tsibble(pivot_longer = FALSE) lung_deaths %>% model(VAR(vars(log(mdeaths), fdeaths) ~ AR(3))) %>% residuals()
#> # A tsibble: 72 x 4 [1M] #> # Key: .model [1] #> .model index mdeaths fdeaths #> <chr> <mth> <dbl> <dbl> #> 1 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Jan NA NA #> 2 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Feb NA NA #> 3 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Mar NA NA #> 4 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Apr 0.113 10.5 #> 5 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 May -0.0398 -69.3 #> 6 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Jun -0.0993 -104. #> 7 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Jul 0.0687 28.0 #> 8 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Aug -0.177 -105. #> 9 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Sep -0.00927 -69.9 #> 10 VAR(vars(log(mdeaths), fdeaths) ~ AR(3)) 1974 Oct 0.138 106. #> # … with 62 more rows