Checking for Normality with the Jarque-Bera Test in R

Introduction

The Jarque-Bera test quickly checks if your data resembles a normal bell curve by measuring skewness and kurtosis, making it especially useful for larger datasets. It’s commonly used in finance, economics, and time series analysis to assess the normality of residuals or returns, which is why it’s included in the tseries package as jarque.bera.test()

The test checks:

  • Skewness: is the data symmetric?

  • Kurtosis: is the peak and tail thickness like a normal bell curve?

It gives a test statistic and a p-value.

Installing and loading the required package

install.packages("tseries")
library(tseries)

Syntax:

jarque.bera.test(your_data)

jarque.bera.test() function does not have a built-in argument like na.rm = TRUE to automatically remove NA values.

Let’s see how this function is used in practice:

data <- c(1.2, 2.4, 2.5, NA, 3.1, 2.9, NA, 3.3, 2.8, 2.2, 3.0, 2.7, 1.9, 2.6, 2.3)

jarque.bera.test(na.omit(data))

    Jarque Bera Test

data:  na.omit(data)
X-squared = 2.0308, df = 2, p-value = 0.3623
# OR

# jarque.bera.test(data[!is.na(data)])

Breaking down the function’s output:

  • X-squared: This is the test statistic based on skewness and kurtosis (Range: 0 to ∞).

    Values close to 0 suggest the data is close to normally distributed.

    Higher values(e.g., 10, 20, 50…) strong evidence data is not normal

  • df: Degrees of freedom (always 2 for this test).

  • p-value: This tells, how likely the data comes from a normal distribution.

    Null hypothesis (H₀): “The data follows a normal distribution.

    p-value > 0.05 → Fail to reject H₀ → data is likely normal.

    p-value < 0.05 → Reject H₀ → data is likely not normal

Conclusion:

Overall, the Jarque-Bera test is a handy tool for spotting non-normality, especially when working with large datasets.