time-to-botec/squiggle/node_modules/jstat/test/distribution/neg-bin-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
835 B
JavaScript

var vows = require('vows');
var assert = require('assert');
var suite = vows.describe('jStat.distribution');
require('../env.js');
suite.addBatch({
'negbin pdf': {
'topic': function() {
return jStat;
},
'check pdf calculation': function(jStat) {
var k = 10; // number of failures
var r = 5; // threshold number of successes
var p = 0.25; // probability of a success
assert(jStat.negbin.pdf(k, r, p), 0.05504866037517786);
}
},
'negbin cdf': {
'topic': function() {
return jStat;
},
'check pdf calculation': function(jStat) {
var k = 10; // number of failures
var r = 5; // threshold number of successes
var p = 0.25; // probability of a success
assert(jStat.negbin.cdf(k, r, p), 0.3135140584781766);
}
},
});
suite.export(module);