Purpose
Model Diagnostics for various ARMA processes

> data(color)
> fit1 <- armaFit(~arma(1, 0), data = color)
> errors <- resid(fit1)
> par(mfrow = c(2, 2))
> summary(fit)
Title:
 ARIMA Modelling
Call: armaFit(formula = ~arma(2, 1), data = color)
Model: ARIMA(2,0,1) with method: CSS-ML
Coefficient(s): ar1 ar2 ma1 intercept 0.2189 0.2735 0.3036 74.1653
Residuals: Min 1Q Median 3Q Max -8.7151 -2.5400 -0.2525 4.0030 10.1194
Moments: Skewness Kurtosis 0.07797 -0.89287
Coefficient(s): Estimate Std. Error t value Pr(>|t|) ar1 0.2189 2.0056 0.109 0.913 ar2 0.2735 1.1376 0.240 0.810 ma1 0.3036 2.0650 0.147 0.883 intercept 74.1653 2.1121 35.114 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sigma^2 estimated as: 24.58 log likelihood: -105.91 AIC Criterion: 219.82
Description: Tue Mar 16 12:37:26 2010 by user: Radha

Chapter_8-001.jpg

> fit2 <- arima(color, order = c(1, 0, 0))
> par(mfrow = c(1, 2))
> plot((errors - mean(errors))/sd(errors), type = "l")
> plot(rstandard(fit2), type = "l")

Chapter_8-002.jpg

> data(hare)
> fit1 <- armaFit(~arma(3, 0), sqrt(hare))
> par(mfrow = c(2, 2))
> summary(fit)
Title:
 ARIMA Modelling
Call: armaFit(formula = ~arma(2, 1), data = color)
Model: ARIMA(2,0,1) with method: CSS-ML
Coefficient(s): ar1 ar2 ma1 intercept 0.2189 0.2735 0.3036 74.1653
Residuals: Min 1Q Median 3Q Max -8.7151 -2.5400 -0.2525 4.0030 10.1194
Moments: Skewness Kurtosis 0.07797 -0.89287
Coefficient(s): Estimate Std. Error t value Pr(>|t|) ar1 0.2189 2.0056 0.109 0.913 ar2 0.2735 1.1376 0.240 0.810 ma1 0.3036 2.0650 0.147 0.883 intercept 74.1653 2.1121 35.114 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sigma^2 estimated as: 24.58 log likelihood: -105.91 AIC Criterion: 219.82
Description: Tue Mar 16 12:37:26 2010 by user: Radha

Chapter_8-003.jpg

> par(mfrow = c(1, 1))
> fit1 <- arima(sqrt(hare), order = c(3, 0, 0), fixed = c(NA, 0,
+     NA, NA))
> plot(rstandard(fit1))

Chapter_8-004.jpg

Is there no way to extract standardized residuals ? I guess no rstudent(fit) works for a fit which is the result of lm fit

Ljung-Box Test is another test which will take the correlations as a group and address the various effects.

Summary of fit as a problem…See R issues slide from the author’s site

Overfitting and Underfitting the parameters.Couple of indicators would be standard errors of the estimates and loglikelihood

> par(mfrow = c(2, 2))
> fit1 <- armaFit(~arma(2, 0), color)
> summary(fit1)
Title:
 ARIMA Modelling
Call: armaFit(formula = ~arma(2, 0), data = color)
Model: ARIMA(2,0,0) with method: CSS-ML
Coefficient(s): ar1 ar2 intercept 0.5173 0.1005 74.1551
Residuals: Min 1Q Median 3Q Max -8.696818 -2.659762 -0.004917 3.911894 10.176310
Moments: Skewness Kurtosis 0.08964 -0.87309
Coefficient(s): Estimate Std. Error t value Pr(>|t|) ar1 0.5173 0.1717 3.013 0.00259 ** ar2 0.1005 0.1815 0.554 0.57983 intercept 74.1551 2.1463 34.550 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sigma^2 estimated as: 24.6 log likelihood: -105.92 AIC Criterion: 217.84
Description: Tue Mar 16 12:59:08 2010 by user: Radha

Chapter_8-005.jpg

> fit2 <- armaFit(~arma(1, 0), color)
> summary(fit2)
Title:
 ARIMA Modelling
Call: armaFit(formula = ~arma(1, 0), data = color)
Model: ARIMA(1,0,0) with method: CSS-ML
Coefficient(s): ar1 intercept 0.5705 74.3293
Residuals: Min 1Q Median 3Q Max -9.2825 -2.4267 -0.4298 3.7144 9.9997
Moments: Skewness Kurtosis 0.001922 -0.869598
Coefficient(s): Estimate Std. Error t value Pr(>|t|) ar1 0.5705 0.1435 3.977 6.97e-05 *** intercept 74.3293 1.9151 38.812 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sigma^2 estimated as: 24.83 log likelihood: -106.07 AIC Criterion: 216.15
Description: Tue Mar 16 12:59:08 2010 by user: Radha

Chapter_8-006.jpg

> fit3 <- armaFit(~arma(1, 1), color)
> summary(fit3)
Title:
 ARIMA Modelling
Call: armaFit(formula = ~arma(1, 1), data = color)
Model: ARIMA(1,0,1) with method: CSS-ML
Coefficient(s): ar1 ma1 intercept 0.6721 -0.1467 74.1730
Residuals: Min 1Q Median 3Q Max -8.61982 -2.69682 -0.01488 3.90259 10.17659
Moments: Skewness Kurtosis 0.08001 -0.86917
Coefficient(s): Estimate Std. Error t value Pr(>|t|) ar1 0.6721 0.2147 3.131 0.00174 ** ma1 -0.1467 0.2742 -0.535 0.59261 intercept 74.1730 2.1357 34.731 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sigma^2 estimated as: 24.63 log likelihood: -105.94 AIC Criterion: 217.88
Description: Tue Mar 16 12:59:09 2010 by user: Radha

Chapter_8-007.jpg

> fit4 <- armaFit(~arma(2, 1), color)
> summary(fit4)
Title:
 ARIMA Modelling
Call: armaFit(formula = ~arma(2, 1), data = color)
Model: ARIMA(2,0,1) with method: CSS-ML
Coefficient(s): ar1 ar2 ma1 intercept 0.2189 0.2735 0.3036 74.1653
Residuals: Min 1Q Median 3Q Max -8.7151 -2.5400 -0.2525 4.0030 10.1194
Moments: Skewness Kurtosis 0.07797 -0.89287
Coefficient(s): Estimate Std. Error t value Pr(>|t|) ar1 0.2189 2.0056 0.109 0.913 ar2 0.2735 1.1376 0.240 0.810 ma1 0.3036 2.0650 0.147 0.883 intercept 74.1653 2.1121 35.114 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sigma^2 estimated as: 24.58 log likelihood: -105.91 AIC Criterion: 219.82
Description: Tue Mar 16 12:59:09 2010 by user: Radha

Chapter_8-008.jpg

# Log likelihood values

> fit1@fit$loglik
[1] -105.9214
> fit2@fit$loglik
[1] -106.0735
> fit3@fit$loglik
[1] -105.9423
> fit4@fit$loglik
[1] -105.9101

Takeaways - QQNORM plot of residuals - Ljung-Box test - ACF and PACF of residuals - All the tests are basically for the stationarity of the residuals - Over fitting and Underfitting - Check the standard errors of the coefficients - AIC gives a more parameters than BIC - AIC reduces error - BIC reduces the parameters