Kalkulator distribusi hipergeometri
P(X = 4 ): 0,06806
P(X < 4 ): 0,01312
P(X ≤ 4 ): 0,08118
P(X > 4 ): 0,91882
P( X≥4 ): 0,98688
function calc() {
//get input values var pop = +document.getElementById('pop').value; var popx = +document.getElementById('popx').value; var sample = +document.getElementById('sample').value; var x = +document.getElementById('samplex').value;
//calculate SE var exactP = jStat.hypgeom.pdf(x, pop, popx, sample); var lessP = jStat.hypgeom.cdf(x-1, pop, popx, sample); var lessEP = jStat.hypgeom.cdf(x, pop, popx, sample); var greatP = 1-jStat.hypgeom.cdf(x, pop, popx, sample); var greatEP = 1-jStat.hypgeom.cdf(x-1, pop, popx, sample);
//output probabilities document.getElementById('exactP').innerHTML = exactP.toFixed(5); document.getElementById('lessP').innerHTML = lessP.toFixed(5); document.getElementById('lessEP').innerHTML = lessEP.toFixed(5); document.getElementById('greatP').innerHTML = greatP.toFixed(5); document.getElementById('greatEP').innerHTML = greatEP.toFixed(5);
document.getElementById('x1').innerHTML = x; document.getElementById('x2').innerHTML = x; document.getElementById('x3').innerHTML = x; document.getElementById('x4').innerHTML = x; document.getElementById('x5').innerHTML = x; }