Extracts the residuals.

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

Arguments

object

The time series model used to produce the forecasts

type

The type of residuals to extract.

...

Additional arguments for forecast model methods.

Value

A vector of fitted residuals.

Examples

USAccDeaths %>% as_tsibble() %>% model(arima = ARIMA(log(value) ~ pdq(0, 1, 1) + PDQ(0, 1, 1))) %>% residuals()
#> # A tsibble: 72 x 3 [1M] #> # Key: .model [1] #> .model index .resid #> <chr> <mth> <dbl> #> 1 arima 1973 Jan 0.00526 #> 2 arima 1973 Feb 0.00227 #> 3 arima 1973 Mar 0.00157 #> 4 arima 1973 Apr 0.00119 #> 5 arima 1973 May 0.00103 #> 6 arima 1973 Jun 0.000930 #> 7 arima 1973 Jul 0.000837 #> 8 arima 1973 Aug 0.000683 #> 9 arima 1973 Sep 0.000512 #> 10 arima 1973 Oct 0.000482 #> # … with 62 more rows