Calculadora de distribuição geométrica
P(X = 7 ): 0,02471
P(X < 7 ): 0,91765
P( X≤7 ): 0,94235
P(X> 7 ): 0,05765
P(X ≥ 7 ): 0,08235
function calc() {
//get input values var p = +document.getElementById('p').value; var x = +document.getElementById('x').value;
//calculate SE var exactP = jStat.negbin.pdf(x, 1, p); var lessP = jStat.negbin.cdf(x-1, 1, p); var lessEP = jStat.negbin.cdf(x, 1, p); var greatP = 1-jStat.negbin.cdf(x, 1, p); var greatEP = 1-jStat.negbin.cdf(x-1, 1, p);
//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; }