observation frequencies
expected frequencies or a discrete probability distribution name
probability mass function (PMF) arguments followed by an optional options object
test results
var x = [ 89, 37, 30, 28, 2 ];
var p = [ 0.40, 0.20, 0.20, 0.15, 0.05 ];
var out = chi2gof( x, p );
var o = out.toJSON();
// returns { 'pValue': ~0.0406, 'statistic': ~9.9901, ... }
Performs a chi-square goodness-of-fit test.
first argument must be an array-like object or a 1-dimensional array containing nonnegative integers
second argument must be either an array-like object (or a 1-dimensional array) of nonnegative numbers, an array-like object (or a 1-dimensional array) of probabilities summing to one, or a discrete probability distribution name
must provide valid options
first and second arguments must have the same length
first argument must contain at least one element greater than zero