time-to-botec/squiggle/node_modules/jstat/test/test/differenceOfProportions-test.js
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

34 lines
954 B
JavaScript

var vows = require('vows');
var assert = require('assert');
var suite = vows.describe('jStat');
require('../env.js');
suite.addBatch({
'differenceOfProportions ': {
'topic': function() {
return jStat;
},
'finds the one sided difference of proportions': function(jStat) {
var p = jStat.fn.oneSidedDifferenceOfProportions(.12, 500, .14, 1000);
assert.isTrue(p > 0.14);
assert.isTrue(p < 0.15);
p = jStat.fn.oneSidedDifferenceOfProportions(.5, 134, .51, 101);
assert.isTrue(p > 0.43);
assert.isTrue(p < 0.44);
},
'finds the two sided difference of proportions': function(jStat) {
var p = jStat.fn.twoSidedDifferenceOfProportions(.12, 500, .14, 1000);
assert.isTrue(p > 0.28);
assert.isTrue(p < 0.29);
p = jStat.fn.twoSidedDifferenceOfProportions(.5, 134, .51, 101);
assert.isTrue(p > 0.87);
assert.isTrue(p < 0.88);
}
}
});
suite.export(module);