deno.land / x / simplestatistic@v7.7.1 / test / chi_squared_goodness_of_fit.test.js

chi_squared_goodness_of_fit.test.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* eslint no-shadow: 0 */
const test = require("tap").test;const ss = require("../");
// Data from Poisson goodness-of-fit example 10-19 in William W. Hines & Douglas C. Montgomery,// "Probability and Statistics in Engineering and Management Science", Wiley (1980).const data1019 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3];
test("chiSquaredGoodnessOfFit", function (t) { t.test( "can reject the null hypothesis with level of confidence specified at 0.05", function (t) { t.equal( false, ss.chiSquaredGoodnessOfFit( data1019, ss.poissonDistribution, 0.05 ) ); t.end(); } ); t.test( "can accept the null hypothesis with level of confidence specified at 0.10", function (t) { t.equal( true, ss.chiSquaredGoodnessOfFit( data1019, ss.poissonDistribution, 0.1 ) ); t.end(); } ); t.test("can tolerate gaps in distribution", function (t) { t.equal( true, ss.chiSquaredGoodnessOfFit( [0, 2, 3, 7, 7, 7, 7, 7, 7, 9, 10], ss.poissonDistribution, 0.1 ) ); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago