Lesson 13 of 15

Jarque-Bera Test

Jarque-Bera Test

The Jarque-Bera (JB) test checks whether a sample comes from a normal distribution by examining skewness and excess kurtosis. A normal distribution has skewness = 0 and excess kurtosis = 0.

The JB statistic is: JB=n6(S2+K24)JB = \frac{n}{6} \left( S^2 + \frac{K^2}{4} \right)

where:

  • nn is the sample size
  • SS is the sample skewness: 1n(xixˉ)3σ^3\frac{\frac{1}{n}\sum(x_i - \bar{x})^3}{\hat{\sigma}^3}
  • KK is the excess kurtosis: 1n(xixˉ)4σ^43\frac{\frac{1}{n}\sum(x_i - \bar{x})^4}{\hat{\sigma}^4} - 3
  • σ^\hat{\sigma} is the population standard deviation (divide by nn)

Under the null hypothesis of normality, JBJB follows a chi-squared distribution with 2 degrees of freedom. Large JBJB values reject normality.

Symmetric data (S=0S = 0) and mesokurtic data (K=0K = 0) yield small JB. Skewed or heavy-tailed data yield large JB.

Your Task

Implement jarque_bera(xs) returning the JB statistic.

Python runtime loading...
Loading...
Click "Run" to execute your code.