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

poisson_distribution.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
/* eslint no-shadow: 0 */
const test = require("tap").test;const ss = require("../");
function rnd(n) { return parseFloat(n.toFixed(4));}
// expected cumulative probabilities taken from Appendix 1, Table I of William W. Hines & Douglas C.// Montgomery, "Probability and Statistics in Engineering and Management Science", Wiley (1980).test("poissonDistribution", function (t) { t.test( "can return generate probability and cumulative probability distributions for lambda = 3.0", function (t) { t.equal("object", typeof ss.poissonDistribution(3.0)); t.equal(rnd(ss.poissonDistribution(3.0)[3]), 0.224, ss.epsilon); t.end(); } ); t.test( "can generate probability and cumulative probability distributions for lambda = 4.0", function (t) { t.equal("object", typeof ss.poissonDistribution(4.0)); t.equal(rnd(ss.poissonDistribution(4.0)[2]), 0.1465, ss.epsilon); t.end(); } ); t.test( "can generate probability and cumulative probability distributions for lambda = 5.5", function (t) { t.equal("object", typeof ss.poissonDistribution(5.5)); t.equal(rnd(ss.poissonDistribution(5.5)[7]), 0.1234, ss.epsilon); t.end(); } ); t.test( "can generate probability and cumulative probability distributions for lambda = 9.5", function (t) { t.equal("object", typeof ss.poissonDistribution(9.5)); t.equal(rnd(ss.poissonDistribution(9.5)[17]), 0.0088, ss.epsilon); t.end(); } ); t.test("can return undefined when lambda <= 0", function (t) { t.equal(undefined, ss.poissonDistribution(0)); t.equal(undefined, ss.poissonDistribution(-10)); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago