Skip to contents

Performs a modified version of the Jarque-Bera test for normality that provides enhanced sensitivity to departures from normal distribution. This implementation includes four different test statistics based on whether population mean and standard deviation are known or estimated.

Usage

jb.test.modified(x, mean = NA, sd = NA)

Arguments

x

A numeric vector of data values to test for normality.

mean

An optional numeric value specifying the known population mean. If NA (default), the sample mean is used.

sd

An optional numeric value specifying the known population standard deviation. If NA (default), the sample standard deviation is used.

Value

An object of class "htest" containing the following components:

  • statistic - The test statistic (chi-squared distributed)

  • parameter - Degrees of freedom (always 2)

  • p.value - The p-value for the test

  • method - Description of the test method

  • data.name - Name of the data vector

Details

The modified Jarque-Bera test evaluates normality by testing whether the sample data has the skewness and kurtosis matching a normal distribution. The test statistic is based on the sample size, skewness, and kurtosis, and follows a chi-squared distribution with 2 degrees of freedom.

Test Variants:

The function implements four different test statistics depending on whether the population mean and standard deviation are specified:

  • Both unknown: Uses sample estimates for mean and variance

  • Mean known, SD unknown: Uses known mean but estimates variance

  • Mean unknown, SD known: Uses sample mean with known variance

  • Both known: Uses known population parameters

Each variant uses different coefficients in the test statistic calculation to account for the uncertainty in parameter estimation.

Mathematical Formulation:

The test statistic is calculated as: $$JB = n \times \left( \frac{S^2}{6} + \frac{(K - 3)^2}{24} \right)$$ where \(S\) is skewness, \(K\) is kurtosis, and \(n\) is sample size, with modified coefficients for different parameter knowledge scenarios.

Note

This test cannot be used for small sample sizes (n < 500) due to the assumption of normality. For smaller samples, consider using the Shapiro-Wilk test.

Reference

KhrushchevSergey/modified_jarque_bera_test Internet. cited 2025 Sep 28. Available from: https://github.com/KhrushchevSergey/Modified-Jarque-Bera-test/blob/main/modified_jarque_bera_test.R

See also

stats::shapiro.test() for the Shapiro-Wilk test

Other normality_test: ad.test(), cvm.test(), dagostino.test(), pearson.test(), sf.test()

Examples

if (FALSE) { # \dontrun{
# Test with sample data (both parameters unknown)
x <- rnorm(100)
test_result <- jb.test.modified(x)
print(test_result)

# Test with known population parameters
x <- rnorm(100, mean = 5, sd = 2)
test_result <- jb.test.modified(x, mean = 5, sd = 2)
print(test_result)

# Test with only known mean
test_result <- jb.test.modified(x, mean = 5)
print(test_result)
} # }