Калькулятор гипергеометрического распределения

@import url('https://fonts.googleapis.com/css?family=Droid+Serif|Raleway');

.axis--y .domain { display: none; }

h1 { text-align: center; font-size: 50px; margin-bottom: 0px; font-family: 'Raleway', serif; }

p { color: black; margin-bottom: 15px; margin-top: 15px; font-family: 'Raleway', sans-serif; }

words {

color: black; font-family: Raleway; max-width: 550px; margin: 25px auto; line-height: 1.75; padding-left: 100px; }

words_calc {

color: black; font-family: Raleway; max-width: 550px; margin: 25px auto; line-height: 1.75; padding-left: 100px; }

hr_top {

width: 30%; margin-bottom: 0px; border: none; height: 2px; color: black; background-color: black; }

hr_bottom {

width: 30%; margin-top: 15px; border: none; height: 2px; color: black; background-color: black; }

words label, input {

display: inline-block; vertical-align: baseline; width: 350px; }

#buttonCalc { border: 1px solid; border-radius: 10px; margin-top: 20px; padding: 10px 10px; cursor: pointer; outline: none; background-color: white; color: black; font-family: 'Work Sans', sans-serif; border: 1px solid grey; /* Green */ }

#buttonCalc:hover { background-color: #f6f6f6; border: 1px solid black; }

words_intro {

color: black; font-family: Raleway; max-width: 550px; margin: 25px auto; line-height: 1.75; } Этот калькулятор находит вероятности, связанные с гипергеометрическим распределением, на основе введенных пользователем данных. Численность населения # Успехи в населении Размер образца # Успехи в выборке (x)  Р(Х = 4 ): 0,06806

Р(Х < 4 ): 0,01312

Р (Х ≤ 4 ): 0,08118

Р(Х > 4 ): 0,91882

Р (Х ≥ 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; }