jarque-bera-test: Jarque-Bera Test for Normality

Description

This function applies the test for normality proposed in Jarque and Bera (1980).

Usage

1
JarqueBera.test(x, fc = 3.5, ...)

Arguments

x

a time series of residuals or an object of class Arima.

fc

a numeric. Factor to asses whether the first residual observations are to be omitted. Ignored if x is not an Arima object. See details.

...

further arguments. Currently omitted.

Details

This function is based on function jarque.bera.test available in package tseries. Here, the results are split in a test for the null hypothesis that the skewness is 0, the null that the kurtosis is 3 and the overall Jarque-Bera test.

The input can be a time series of residuals, jarque.bera.test.default, or an Arima object, jarque.bera.test.Arima from which the residuals are extracted. In the former case the whole input series of residuals is used. In the latter case, the first n0 (defined below) residuals are omitted if they are are equal to zero or if any of them are in absolute value larger than fc times the standard deviation of the remaining residuals. n0 is set equal to x$arma[6] + x$arma[5] * x$arma[7], i.e. the number of regular differences times the periodicity of the data times the number of seasonal differences. If n0 happens to be equal to 1 it is set to 2.

If the latter trimming operation is not desired, the argument fc can be set to a high value to ensure the complete series of residuals in considered; or the function can be called as jarque.bera.test(residuals(x)).

Missing observations are omitted.

Value

A list containing one htest object for the null hypothesis that the kurtosis is 3, the skewness is 0 and a test combining both the kurtosis and the skewness to test for the normality of the input data.

References

Jarque, C. M. and Bera, A. K. (1980). ‘Efficient test for normality, homoscedasticity and serial independence of residuals’. Economic Letters, 6(3), pp. 255-259.

See Also

print.mhtest.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# fit an ARIMA model to the HICP 011600 series
# ARIMA(0,1,0)(2,0,1) was chosen by forecast::auto.arima(ic = "bic")
# normality of the residuals is rejected at the 5% significance level
# due to an excess of kurtosis
data("hicp")
y <- log(hicp[["011600"]])
fit1 <- arima(y, order = c(0, 1, 0), seasonal = list(order = c(2, 0, 1)))
JarqueBera.test(fit1)
JarqueBera.test(residuals(fit1))

# fit ARIMA model for the same series including outliers that were
# detected by "tso" and for the model chosen by "auto.arima"
# normality of the residuals is not rejected at the 5% significance level
# after including the presence of outliers
mo <- outliers(c("AO", "AO", "LS", "LS"), c(79, 210, 85, 225))
xreg <- outliers.effects(mo, length(y))
fit2 <- arima(y, order = c(1, 1, 0), seasonal = list(order = c(2, 0, 2)), 
  xreg = xreg)
JarqueBera.test(fit2)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.