dataFrame.columns.stat — chiSq()
Description
The chiSq() method of the stat object performs a chi² test of independence on the selected columns.
Signature
dataFrame.columns(...columnNames).stat.chiSq()Argument
...columnNames( string[] )- The name of the columns from which to compute the chi².
Returns
stat( object[] )- A statistic object containing the chi² test results.
chiSq(number)- The chi² statistic.
p_value(number)- The p-value associated with the test.
confidence(number)- A confidence score computed from the test p-value as
1 - p_value. df(number)- The degrees of freedom of the test.
Notes
- The test evaluates whether the selected categorical variables are statistically independent.
- The null hypothesis assumes that the variables are independent.
- Small p-values indicate stronger evidence against independence.
- The
confidencescore is calculated as1 - p_value.
Example
// evaluate a chi² test for 2 columns of the dataFrame
var stat = dataFrame.columns('groupA', 'groupB').stat.chiSq();
// log the stat details
notebook.log(stat);