Przedział ufności dla kalkulatora współczynnika korelacji
95 % CI = [ 0,2502 , 0,7658 ]
function calc() {
//get input values var r = +document.getElementById('r').value; var n = +document.getElementById('n').value; var conf = +document.getElementById('conf').value;
var confUse = conf - (-(1-conf)/2); var confOut = conf*100;
//calculate stuff var zr = Math.log((1-(-1*r))/(1-r))/2; var z = Math.abs(jStat.normal.inv(confUse, 0, 1)); var L = zr - (z/Math.sqrt(n-3)); var U = zr - -1*((z/Math.sqrt(n-3)));
var low = (Math.exp(2*L)-1) / (Math.exp(2*L)-(-1*1)); var high = (Math.exp(2*U)-1) / (Math.exp(2*U)-(-1*1));
//output results document.getElementById('confOut').innerHTML = confOut; document.getElementById('confOut2').innerHTML = confOut; document.getElementById('low').innerHTML = low.toFixed(4); document.getElementById('low2').innerHTML = low.toFixed(4); document.getElementById('high').innerHTML = high.toFixed(4); document.getElementById('high2').innerHTML = high.toFixed(4); }