Learn R Programming

gets (version 0.2)

diagnostics: Diagnostics tests of residuals

Description

Auxiliary function (i.e. not intended for the average user) called by the getsm, getsv and isat functions. The diagnostics function tests for autocorrelation, ARCH and non-normality in a residual series. The autocorrelation and ARCH tests are conducted as Ljung and Box (1979) tests of autocorrelation in the residuals and squared residuals, respectively, whereas the test for non-normality is that of Jarque and Bera (1980)

Usage

diagnostics(x, s2=1, ar.LjungB=c(1,0.025), arch.LjungB=c(1,0.025),
  normality.JarqueB=NULL, verbose=FALSE)

Arguments

x
numeric vector, typically the residuals from a regression
s2
the standard deviation of x
ar.LjungB
a two element vector or NULL. In the former case, the first element contains the AR-order, the second element the p-value. If NULL, then a test for autocorrelation is not conducted
arch.LjungB
a two element vector or NULL. In the former case, the first element contains the ARCH-order, the second element the p-value. If NULL, then a test for ARCH is not conducted
normality.JarqueB
a value between 0 and 1 or NULL. In the former case, a test for non-normality is conducted using a significance level equal to the numeric value. If NULL, then no test for non-normality is conducted
verbose
unused

Value

  • logical. If TRUE, then the residuals series passes the diagnostics tests

References

G. Ljung and G. Box (1979): 'On a Measure of Lack of Fit in Time Series Models'. Biometrika 66, pp. 265-270 C. Jarque and A. Bera (1980): 'Efficient Tests for Normality, Homoscedasticity and Serial Independence'. Economics Letters 6, pp. 255-259

See Also

getsm, getsv, isat

Examples

Run this code
##check for autocorrelation, ARCH and non-normality:
diagnostics(rnorm(40))

Run the code above in your browser using DataLab