Eén proportie z-testcalculator
- p = waargenomen monsteraandeel
- p 0 = hypothetisch deel van de bevolking
- n = steekproefomvang
z-statistiek: 0,55487
p-waarde (eenzijdig): 0,28949
p-waarde (2-zijdig): 0,57898
95% BI = [ 0,2914 , 0,6486 ]
function calc() {
//get input values var p0 = +document.getElementById('p0').value; var p = +document.getElementById('p').value; var n = +document.getElementById('n').value;
//calculate stuff var z = (p-p0)/(Math.sqrt(p0*(1-p0)/n));
//calculate p-value if (z<0) { var p1 = jStat.normal.cdf(z, 0, 1); var p2 = p1*2; } else { var p1 = 1-jStat.normal.cdf(z, 0, 1); var p2 = p1*2; } //calculate C.I. var zCrit = Math.abs(jStat.normal.inv(.975, 0, 1)); var se = Math.sqrt(p*(1-p)/n); var low = p - (zCrit*se); var high = p - (-1*zCrit*se); //output probabilities document.getElementById('z').innerHTML = z.toFixed(5); document.getElementById('p1').innerHTML = p1.toFixed(5); document.getElementById('p2').innerHTML = p2.toFixed(5); document.getElementById('low').innerHTML = low.toFixed(4); document.getElementById('high').innerHTML = high.toFixed(4); }