Open In App

How to Conduct a Jarque-Bera Test in R

In this article, we will discuss What is the Jarque-Bera Test and how we perform the Jarque-Bera Test in R Programming Language.

What is the Jarque-Bera Test?

The Jarque-Bera test is a statistical test used to assess whether a given dataset follows a normal distribution based on its skewness and kurtosis. Its purpose is to determine if the data conforms to the assumptions of many statistical techniques that rely on the normality assumption, such as linear regression and t-tests. By testing for normality, the Jarque-Bera test helps ensure the validity of statistical analyses and the reliability of their results.

After conducting the test, you will typically obtain a test statistic and its associated p-value. Here's how to interpret the results:

A larger test statistic indicates a greater departure from normality.

The test statistic for the Jarque-Bera test is computed based on the skewness and kurtosis of the dataset. Specifically, it uses the following formula:

[Tex]JB = \frac{n}{6} \left( S^2 + \frac{1}{4}(K - 3)^2 \right) [/Tex]

Where:

Under the null hypothesis of normality, the test statistic JB asymptotically follows a chi-square distribution with two degrees of freedom (because there are two parameters estimated from the sample data: skewness and kurtosis).

To conduct the Jarque-Bera test, we compare the computed test statistic with the critical value from the chi-square distribution at a chosen significance level. If the test statistic is greater than the critical value, then we reject the null hypothesis, indicating that the data is not normally distributed.

Preparing the data properly before conducting the test

  1. Accuracy of Results: Preparing the data properly helps ensure that the data accurately reflects the underlying phenomenon being studied. This includes verifying the correctness of data entries, addressing missing or erroneous values, and checking for outliers or anomalies.
  2. Assumption of Normality: The Jarque-Bera test assumes that the data are drawn from a normal distribution. Therefore, it's essential to confirm that this assumption holds true before conducting the test. Data preparation may involve transforming the data or identifying and addressing any violations of normality assumptions.
  3. Quality of Inferences: The conclusions drawn from the Jarque-Bera test can influence subsequent analyses or decisions. Proper data preparation helps mitigate potential biases or errors in these inferences, ensuring that they are accurate and reliable.
  4. Validity of Statistical Analyses: Many statistical methods and models rely on the normality assumption. If the data violate this assumption, the results of subsequent analyses may be invalid or misleading. Proper data preparation helps ensure that the data conform to the assumptions required by the statistical techniques being applied.
  5. Robustness of Findings: Well-prepared data contribute to the robustness of research findings. By addressing potential issues in the data before conducting the Jarque-Bera test, researchers can have greater confidence in the reliability and generalizability of their results.

Jarque-Bera Test in R

To perform Jarque-Bera Test in R there are a function called jarque.bera.test() . There are some steps that we need to follow.

Step 1: Load the Required Package

Firstly install and load the tseries package. Install it using install.packages("tseries") and then load it using library(tseries).

Step 2 : Prepare the Data

Ensure that the data is properly prepared and stored in a format that R can recognize. This may involve loading a dataset from a file or creating a vector or matrix of data within R.

Step 3: Call the Function

Use the jarque.bera.test() function, passing the data as an argument.

Here is the example tseries library, which contains the jarque.bera.test() function.

# Load required library
library(tseries)

# Generate some random data
data <- rnorm(100)

# Perform the Jarque-Bera test
jb_test <- jarque.bera.test(data)

# Print the test result
print(jb_test)

Output:

    Jarque Bera Test

data:  data
X-squared = 0.013514, df = 2, p-value = 0.9933

Firstly load the tseries library, which contains the jarque.bera.test() function for performing the Jarque-Bera test.

Since the p-value is greater than the common significance levels (e.g., 0.05), we fail to reject the null hypothesis of normality. This suggests that there is no strong evidence to suggest that the data significantly deviates from a normal distribution.

Jarque-Bera test using the moments package in R

Here is another example of performing the Jarque-Bera test using the moments package in R.

# Install and load required library
install.packages("moments")
library(moments)

# Generate some random data
data <- rnorm(100)

# Perform the Jarque-Bera test
jb_test <- jarque.test(data)

# Print the test result
print(jb_test)

Output:

    Jarque-Bera Normality Test

data:  data
JB = 0.45895, p-value = 0.795
alternative hypothesis: greater

First install and load the moments package which contains the jarque.test() function.

Jarque-Bera statistic: This is the test statistic for the Jarque-Bera test. It quantifies the departure of the sample skewness and kurtosis from the skewness and kurtosis of a normal distribution. Here, the JB statistic is 0.15467.

Uses of the Jarque-Bera Test in R

  1. Normality Check: JB test assesses whether data follows a normal distribution.
  2. Quality Control: Used in finance, economics, and other fields to detect anomalies in data.
  3. Model Validation: Ensures that statistical models meet the assumption of normality for accurate results.
  4. Robustness Checks: Part of sensitivity analysis to verify the robustness of research findings.
  5. Guide for Analysis: Helps decide between parametric and non-parametric methods based on data distribution.
  6. Data Preprocessing: Guides preprocessing steps like data transformations for better analysis.

Conclusion

The Jarque-Bera (JB) test is a critical statistical tool used to evaluate the normality assumption of a dataset. By examining skewness and kurtosis, the JB test provides insights into the distributional properties of the data. This test holds significance across various domains, including finance, economics, and research, serving as a quality control measure to detect anomalies and irregularities in data.Overall, it ensures the reliability of research findings.

Article Tags :