# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.test.distribution.normality

## Class JarqueBera

• public class JarqueBera
extends HypothesisTest
The Jarque-Bera test is a goodness-of-fit measure of departure from normality, based on the sample kurtosis and skewness. The JB statistic has an asymptotic chi-square distribution with two degrees of freedom and can be used to test the null hypothesis that the data are from a normal distribution. The null hypothesis is a joint hypothesis of the skewness being 0 and the excess kurtosis being 0, since samples from a normal distribution have an expected skewness of 0 and an expected excess kurtosis of 0 (which is the same as a kurtosis of 3). As the definition of JB shows, any deviation from this increases the JB statistic.

The R equivalent function is rjb.test in package lawstat, or jarque.bera.test in package tseries for N > 2000.

Wikipedia: Jarque-Bera test
• ### Field Summary

Fields
Modifier and Type Field and Description
int nSim
• ### Constructor Summary

Constructors
Constructor and Description
JarqueBera(double[] sample)
Perform the Jarque-Bera test to test for the departure from normality, using the asymptotic chi-square distribution.
JarqueBera(double[] sample, boolean isExact)
Perform the Jarque-Bera test to test for the departure from normality.
• ### Method Summary

All Methods
Modifier and Type Method and Description
String getAlternativeHypothesis()
Get the description of the alternative hypothesis.
String getNullHypothesis()
Get a description of the null hypothesis.
double pValue()
Get the p-value for the test statistics.
double statistics()
Get the test statistics.
• ### Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest

isNullRejected, nGroups, nObs, oneSidedPvalue
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

• ### Constructor Detail

• #### JarqueBera

public JarqueBera(double[] sample,
boolean isExact)
Perform the Jarque-Bera test to test for the departure from normality.
Parameters:
sample - a sample
isExact - true if the exact Jarque-Bera distribution is to be used
• #### JarqueBera

public JarqueBera(double[] sample)
Perform the Jarque-Bera test to test for the departure from normality, using the asymptotic chi-square distribution.
Parameters:
sample - a sample
• ### Method Detail

• #### getNullHypothesis

public String getNullHypothesis()
Description copied from class: HypothesisTest
Get a description of the null hypothesis.
Specified by:
getNullHypothesis in class HypothesisTest
Returns:
the null hypothesis description
Wikipedia: Null hypothesis
• #### getAlternativeHypothesis

public String getAlternativeHypothesis()
Description copied from class: HypothesisTest
Get the description of the alternative hypothesis.
Specified by:
getAlternativeHypothesis in class HypothesisTest
Returns:
the alternative hypothesis description
Wikipedia: Alternative hypothesis
• #### statistics

public double statistics()
Description copied from class: HypothesisTest
Get the test statistics.
Specified by:
statistics in class HypothesisTest
Returns:
the test statistics
Wikipedia: Test statistic
• #### pValue

public double pValue()
Description copied from class: HypothesisTest
Get the p-value for the test statistics.
Specified by:
pValue in class HypothesisTest
Returns:
the p-value