Statistics Toolbox    
jbtest

Jarque-Bera test for goodness-of-fit to a normal distribution

Syntax

Description

H = jbtest(X) performs the Jarque-Bera test on the input data vector X and returns H, the result of the hypothesis test. The result is H=1 if we can reject the hypothesis that X has a normal distribution, or H=0 if we cannot reject that hypothesis. We reject the hypothesis if the test is significant at the 5% level.

The Jarque-Bera test evaluates the hypothesis that X has a normal distribution with unspecified mean and variance, against the alternative that X does not have a normal distribution. The test is based on the sample skewness and kurtosis of X. For a true normal distribution, the sample skewness should be near 0 and the sample kurtosis should be near 3. The Jarque-Bera test determines whether the sample skewness and kurtosis are unusually different than their expected values, as measured by a chi-square statistic.

The Jarque-Bera test is an asymptotic test, and should not be used with small samples. You may want to use lillietest in place of jbtest for small samples.

H = jbtest(X,alpha) performs the Jarque-Bera test at the 100*alpha% level rather than the 5% level, where alpha must be between 0 and 1.

[H,P,JBSTAT,CV] = jbtest(X,alpha) returns three additional outputs. P is the p-value of the test, JBSTAT is the value of the test statistic, and CV is the critical value for determining whether to reject the null hypothesis.

Example

We can use jbtest to determine if car weights follow a normal distribution.

With a p-value of 2.67%, we reject the hypothesis that the distribution is normal. With a log transformation, the distribution becomes closer to normal but is still significantly different at the 5% level.

See lillietest for a different test of the same hypothesis.

Reference

[1]  Judge, G. G., R. C. Hill, W. E. Griffiths, H. Lutkepohl, and T.-C. Lee. Introduction to the Theory and Practice of Econometrics. New York, Wiley.

See Also
hist, kstest2, lillietest


  iwishrnd kmeans