Learn R Programming

normtest (version 1.1)

jb.norm.test: Jarque--Bera test for normality

Description

Performs Jarque--Bera test for the composite hypothesis of normality, see Jarque and Bera (1987).

Usage

jb.norm.test(x, nrepl=2000)

Arguments

x
a numeric vector of data values.
nrepl
the number of replications in Monte Carlo simulation.

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the Jarque--Bera statistic.
  • p.valuethe p-value for the test.
  • methodthe character string "Jarque-Bera test for normality".
  • data.namea character string giving the name(s) of the data.

Details

The Jarque--Bera test for normality is based on the following statistic: $$JB = \frac{n}{6}\left((\sqrt{b_1})^2 + \frac{(b_2-3)^2}{4}\right),$$ where $$b_1 = \frac{\frac{1}{n}\sum_{i=1}^n(X_i - \overline{X})^3}{\frac{1}{n}(\sum_{i=1}^n(X_i - \overline{X})^2)^{3/2}},$$ $$b_2 = \frac{\frac{1}{n}\sum_{i=1}^n(X_i - \overline{X})^4}{\frac{1}{n}(\sum_{i=1}^n(X_i - \overline{X})^2)^2}.$$ The p-value is computed by Monte Carlo simulation.

References

Jarque, C. M. and Bera, A. K. (1987): A test for normality of observations and regression residuals. --- International Statistical Review, vol. 55, pp. 163--172.

Examples

Run this code
jb.norm.test(rnorm(100))
jb.norm.test(abs(runif(100,-2,5)))

Run the code above in your browser using DataLab