Overview
The chi square distribution ({% U %}) is derived from the normal distribution.
{% U = Z^2 %}
if {% Z %} is a standard normal variable. {% U %} is called a chi square distribution with {% 1 %} degree of freedom.
{% V = \sum_i^n U_i %}
where each {% U_i %} is a chi-square variable with {% 1 %} degree of freedom. {% V %} is called a chi square distribution
with {% n %} degrees of freedom.
Functions related to the chi-square distribution are implemented in the Chi Square Library
Hypothesis Tests
If a test statistic has been formulated within the framework of Hypothesis Testing the Chi Square Library can be used to calculate the cumulative probability of the statistic. Hypothesis testing will reject the null hypothesis if the computed probability is in the tails.
let cs = await import('/lib/statistics/distributions/chi-square/v1.0.0/chi-square.mjs');
//3 degrees of freedom, value of 1
let val = cs.cumulative(3,1);