Skip to main content

jarque_bera_test

Function jarque_bera_test 

Source
pub fn jarque_bera_test(data: &[f64]) -> Option<TestResult>
Expand description

Jarque-Bera normality test: H₀: data is normally distributed.

§Algorithm

JB = (n/6) · [S² + (K²/4)]

where S = skewness, K = excess kurtosis. JB ~ χ²(2) under H₀.

§Returns

None if fewer than 8 observations or non-finite values.

§References

Jarque & Bera (1987). “A test for normality of observations and regression residuals”. International Statistical Review, 55(2), 163–172.

§Examples

use u_analytics::testing::jarque_bera_test;

// Near-normal data
let data = [-1.5, -1.0, -0.5, 0.0, 0.0, 0.5, 1.0, 1.5];
let r = jarque_bera_test(&data).unwrap();
assert!(r.p_value > 0.05); // cannot reject normality