Konfidenzintervall für differenz-mittelwert-rechner
- x 1 , x 2 : Mittelwert von Stichprobe 1, Mittelwert von Stichprobe 2
- t: der t-kritische Wert basierend auf dem Konfidenzniveau
- s p 2 : gruppierte Varianz
- n 1 , n 2 : Stichprobengröße 1, Stichprobengröße 2
95 % KI = [ -2,0049 , 3,6049 ]
function calc() {
//get input values var x1 = +document.getElementById('x1').value; var s1 = +document.getElementById('s1').value; var n1 = +document.getElementById('n1').value; var x2 = +document.getElementById('x2').value; var s2 = +document.getElementById('s2').value; var n2 = +document.getElementById('n2').value; var conf = +document.getElementById('conf').value;
var confUse = conf - (-(1-conf)/2); var confOut = conf*100; var df = n1 - (-1*n2) - 2; var s2p = ((n1-1)*(Math.pow(s1,2)) - ((-1*(n2-1))*Math.pow(s2,2))) / df;
//calculate stuff var meanDiff = x1-x2; var t = jStat.studentt.inv(confUse, df); var se = Math.sqrt((s2p/n1) - (-1*s2p/n2));
var low = meanDiff - (t*se); var high = meanDiff - (-1*t*se); console.log(s2p);
//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); }