Learn R Programming

desk (version 1.1.2)

jb.test: Jarque-Bera Test

Description

Jarque-Bera test for normality. The object of test results returned by this command can be plotted using the plot() function.

Usage

jb.test(x, data = list(), sig.level = 0.05, details = FALSE, hyp = TRUE)

Value

A list object including:

hypcharacter matrix of hypotheses (if hyp = TRUE).
resultsa data frame of basic test results.
skewmoment of order 3 (asymmetry, skewness).
kurmoment of order 4 (kurtosis).
nobsnumber of observations (internal purpose).
nulldisttype of the Null distribution and its parameter(s).

Arguments

x

a numeric vector, an estimated linear model object or model formula (with data specified). In the two latter cases the model's residuals are tested for normality.

data

if mod is a formula then the corresponding data frame has to be specified.

sig.level

significance level. Default value: sig.level = 0.05.

details

logical value indicating whether specific details about the test should be returned.

hyp

logical value indicating whether the hypotheses should be returned.

Details

Under H0 the test statistic of the Jarque-Bera test follows a chi-squared distribution with 2 degrees of freedom. If moment of order 3 (skewness) differs significantly from 0 and/or moment of order 4 (kurtosis) differs significantly from 3, H0 is rejected.

References

Jarque, C.M. & Bera, A.K. (1980): Efficient Test for Normality, Homoscedasticity and Serial Independence of Residuals. Economics Letters 6 Issue 3, 255-259.

See Also

`jarque.test()` in Package `moments`.

Examples

Run this code
## Test response variable for normality
X <- jb.test(data.income$loginc)
X

## Estimate linear model
income.est <- ols(loginc ~ logsave + logsum, data = data.income)
## Test residuals for normality, print details
jb.test(income.est, details = TRUE)

## Equivalent test
jb.test(loginc ~ logsave + logsum, data = data.income, details = TRUE)

## Plot the test result
plot(X)

Run the code above in your browser using DataLab