Extracts the residuals.
# S3 method for class 'VAR'
residuals(object, ...)
A vector of fitted residuals.
lung_deaths <- cbind(mdeaths, fdeaths) %>%
as_tsibble(pivot_longer = FALSE)
lung_deaths %>%
model(VAR(vars(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(mdeaths, fdeaths) ~ AR(3)) 1974 Jan NA NA
#> 2 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Feb NA NA
#> 3 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Mar NA NA
#> 4 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Apr 189. 26.7
#> 5 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 May -46.7 -66.2
#> 6 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Jun 25.4 -45.8
#> 7 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Jul 60.3 21.2
#> 8 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Aug -291. -112.
#> 9 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Sep -102. -83.7
#> 10 VAR(vars(mdeaths, fdeaths) ~ AR(3)) 1974 Oct 150. 102.
#> # ℹ 62 more rows