-
-
Notifications
You must be signed in to change notification settings - Fork 913
Description
Description
I'm evaluating chi2test. In some cases I'm getting results that differ from other chi square independence tests available on the web.
As a pattern it seems to me that chi2test is producing results expected if number of columns and number of rows are equal but give different results if there are more rows than columns or vice versa.
I'm using the following examples and implementations to get the results to compare to:
a) the initial example is from Zed Statistics video on Chi Square Independence: https://www.youtube.com/watch?v=NTHA9Qa81R8&t=925s
b) The other comparison results are calculated with the help of https://www.mathsisfun.com/data/chi-square-calculator.html and http://quantpsy.org/chisq/chisq.htm.
Am I doing something wrong? Or is there a bug in chi2test or in the other implementations and examples?
Related Issues
Related issues # , # , and # .
Questions
No.
Demo
No response
Reproduction
import chi2test from '@stdlib/stats-chi2test';
import array from '@stdlib/ndarray-array';
describe('chi2test', () => {
it('should give the results expected ', () => {
// example from Zed Statistics
const res1 = chi2test(array([
[15, 30, 5],
[20, 35, 15]
]));
expect(res1.statistic).toBeCloseTo(2.845, 3); // fails. result from chi2test is 1.056
const res2 = chi2test(array([
[15, 30, 5],
[20, 35, 15],
[30, 45, 25]
]));
expect(res2.statistic).toBeCloseTo(5.247, 3); // success.
const res3 = chi2test(array([
[15, 30, 5],
[20, 35, 15],
[30, 45, 25],
[35, 50, 30]
]));
expect(res3.statistic).toBeCloseTo(6.759, 3); // fails. result from chi2test is 5.539
const res4 = chi2test(array([
[15, 30, 5, 20],
[20, 35, 15, 25],
[30, 45, 25, 30],
[35, 50, 30, 40]
]));
expect(res4.statistic).toBeCloseTo(7.355, 3); // success.
});
});
Expected Results
No response
Actual Results
No response
Version
"@stdlib/stats-chi2test": "0.0.6"
Environments
Node.js
Browser Version
No response
Node.js / npm Version
node.js 12.16.2
Platform
Mac OS X, Big Sur, 11.5.2
Checklist
- Read and understood the Code of Conduct.
- Searched for existing issues and pull requests.