Binomial distribution calculator, allows you to calculate binomial probabilities without using lengthy equations.
Features
Use this calculator to compute the probability of number of successes in number of events.
Binomial distribution is completely defined by two parameters which is n and p.
Probability of success must be between 0 and 1.
Online Javascript calculator, helps to estimate the binomial distribution in few seconds.
Simple, flexible and responsive calculator.
Preview
Binomial Distribution - Calculator
Downloads
Code
<!-- Script by hscripts.com --> <!-- More scripts @www.hscripts.com --> <html> <head>
<title>Binomial Distribution Calculator in Javascript </title> <script type="text/javascript"> function chk(){ var sds = document.getElementById('dum'); if(sds == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");
document.getElementById("maindiv").style.visibility="hidden"; } var sdss = document.getElementById("dumdiv"); if(sdss == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");} }
window.onload=chk; function allnumeric(inputtxt) {var numbers = /^[0-9]+$/; if(!inputtxt.value.match(numbers)) { inputtxt.value = ''; } } function check(ad) { var ch=ad.value; if(isNaN(ch)) { var df=ch.substring(0,(ch.length-1));ad.value=df;} } function ck() {alert("this"); } function minmax(value)
{if(parseInt(value) > 150){alert("Enter number of events below 150"); document.getElementById("n").value=''; }} function bin() {var a = document.getElementById("n").value; var b = document.getElementById("r").value; var c = document.getElementById("p").value; if(a == ""){alert("Enter the number of events");} else if(b == ""){alert("Enter the number of success");} else if(c == ""){alert("Enter the Probability of success");}
else{a=parseFloat(a);b=parseFloat(b);c=parseFloat(c);if(c>1){alert("The probability of success must be between 0 and 1");}else if(b>a){alert("Number of success r should be less than number of events n");}else{
//n! var z=1;for(var i=a; i>=1; i--){z=z*i;}//r! var x=1;for(var k=b;k>=1;k--){x=x*k;}
//(n-r)! var s=a-b;var t=1;for(var j=s;j>=1;j--){t=t*j;}//PERMUTATION [ n!/(n-r)! ] var p=z/t; //COMBINATION [ (n!/(n-r)!) / r! ] , nCr = y ; 1-p = d ; n-r = e ; p^r=f var y=p/x;var d=1-c;var e=a-b;var f=Math.pow(c,b);var g=Math.pow(d,e); //BINOMIAL DISTRIBUTION var res=y*f*g;if(res=="Infinity"){res = 0;}res=res.toFixed(7);