jbtest(x: array): number
Performs the Jarque-Bera test for normality.
Tests the null hypothesis that the input data follows a normal distribution with an unknown mean and variance. The test statistic combines skewness and excess kurtosis.
Example 1
Example 1
import { assertEquals, assertAlmostEquals } from "jsr:@std/assert"; const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];
Compute the Jarque-Bera test statistic for normality
Compute the Jarque-Bera test statistic for normality
import { assertEquals, assertAlmostEquals } from "jsr:@std/assert"; const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039]; assertAlmostEquals(jbtest(x), 0.6360604293924916, 1e-13);
Compute JB test statistic for a dataset with more variation
Compute JB test statistic for a dataset with more variation
import { assertEquals, assertAlmostEquals } from "jsr:@std/assert"; assertAlmostEquals(jbtest([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 0.6244872972145701, 1e-13);
x: array
The dataset (array of values).