Jarque-Bera Test
Calculate the Jarque-Bera test for normality.
The test combines sample skewness and excess kurtosis into a single statistic that is chi-squared distributed with 2 degrees of freedom under the null hypothesis that returns are normally distributed. A significant result (low p-value) indicates that returns are not normally distributed, which is relevant when choosing between e.g. gaussian and Student-T based Value at Risk models.
For more information about the method, see the following paper:
- Jarque, C.M. and Bera, A.K. (1987). “A Test for Normality of Observations and Regression Residuals.” International Statistical Review, 55(2), 163-172.
Also known as: JB test, normality test.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Jarque-Bera Test for you. Just ask in plain English.
Calculate the Jarque-Bera Test in Python
The Jarque-Bera Test is available in the Econometrics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_jarque_bera_test as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.econometrics.get_jarque_bera_test(period="quarterly")
Which returns:
| AMZN | TSLA | |
|---|---|---|
| Jarque-Bera Statistic | 3.0505 | 1.9354 |
| P-Value | 0.2175 | 0.38 |
Parameters
get_jarque_bera_test accepts the following parameters:
- period (str, optional): The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”.
- within_period (bool, optional): Whether to calculate the test within the specified period or for the entire period. Thus whether to look at the test within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to False.
- include_benchmark (bool, optional): Whether to include “Benchmark” among the assets tested. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Related Diagnostics
The Econometrics module page introduces the module, and the sidebar lists all of its functions.