This utility function is useful to use in the portmanteau functions, BoxPierce, MahdiMcLeod, Hosking, LiMcLeod, LjungBox, and portest. GetResiduals() function takes a fitted time-series object with class "ar", "arima0", "Arima", ("ARIMA forecast ARIMA Arima"), "lm", ("glm" "lm"), "varest", or "list". and returns the residuals and the order from the fitted object.

This method and the bottom documentation is taken directly from the original 'portes' package.

GetResiduals(obj)

Arguments

obj

a fitted time-series model with class "ar", "arima0", "Arima", ("ARIMA forecast ARIMA Arima"), "lm", ("glm" "lm"), "varest", or "list".

Value

List of order of fitted time series model and residuals from this model.

Author

Esam Mahdi and A.I. McLeod.

Examples

fit <- arima(Nile, c(1, 0, 1))
GetResiduals(fit)
#> $order
#> [1] 2
#> 
#> $res
#> Time Series:
#> Start = 1 
#> End = 100 
#> Frequency = 1 
#>   [1]  165.283570  133.142432  -96.534989  202.879223   94.885692   82.334118
#>   [7] -271.106298  261.711204  318.472000   -2.691688 -115.908005 -109.663230
#>  [13]  120.234336  -27.437452   21.998623  -34.796583  207.465496 -237.553759
#>  [19]   19.132640  197.106564   92.526601  182.829165   74.859777  170.629218
#>  [25]  144.100790   81.756361 -106.075932   30.289025 -285.390942 -102.105493
#>  [31]  -30.050624 -202.024811  109.939032  -47.383975 -168.693997   97.166693
#>  [37] -174.330277  205.998522  150.459320   14.874581 -123.569674 -181.412828
#>  [43] -390.944744  101.072681  -83.088964  344.622948  186.116721 -146.719660
#>  [49] -156.258547  -45.643463  -90.460003    8.975829   13.150275   -3.049121
#>  [55] -173.713317   26.151449  -97.957985  -23.239964  214.665142 -153.275576
#>  [61]  -79.793801   23.303655  -15.653841   80.399608   84.879288  -34.244734
#>  [67]  -96.000882  124.609114 -162.064820 -199.676891 -164.346052   74.193675
#>  [73]   -5.947824  -88.160049  -11.445460  216.465711  -51.343430  -20.992903
#>  [79]  -43.335670    9.485617 -145.334333  -94.766481   16.106872  208.869531
#>  [85]   -5.886720   64.597287 -146.466789   33.010103   69.428602 -116.493778
#>  [91]  130.027584  -32.870486  -24.039145  253.838191  -91.936045 -214.783584
#>  [97]   37.557804 -181.772761 -126.242453  -68.050355
#>