deno.land / x / simplestatistic@v7.7.1 / test / iqr.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
/* eslint no-shadow: 0 */
const test = require("tap").test;const ss = require("../");
test("interquartile range (iqr)", function (t) { // Data and results from // [Wikipedia](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population) t.test("can get proper iqr of an even-length list", function (t) { const even = [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]; t.equal( ss.quantile(even, 0.75) - ss.quantile(even, 0.25), ss.iqr(even) ); t.end(); });
t.test("can get proper iqr of an odd-length list", function (t) { const odd = [3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20]; t.equal(ss.quantile(odd, 0.75) - ss.quantile(odd, 0.25), ss.iqr(odd)); t.end(); });
t.test("an iqr of a zero-length list cannot be calculated", function (t) { t.throws(function () { ss.iqr([]); }); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago