Interval kepercayaan untuk kalkulator deviasi standar
- n: ukuran sampel
- s 2 : varians sampel
- X 2 : nilai kritis Chi kuadrat dengan derajat kebebasan n-1
CI 95 % = [ 5,0637 , 8,8119 ]
function calc() {
//get input values var n = +document.getElementById('n').value; var s = +document.getElementById('s').value; var conf = +document.getElementById('conf').value;
var s2 = Math.pow(s,2); var df = n-1; var confUse = 1-conf; var confOut = conf*100;
var x2high = jStat.chisquare.inv(confUse/2, df); var x2low = jStat.chisquare.inv(1-(confUse/2), df);
//calculate stuff var low = Math.sqrt(df*s2/x2low); var high = Math.sqrt(df*s2/x2high);
//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); }