Calculadora de teste t de duas amostras
Amostra 1
Amostra 2
t = -1,608761
df = 22
Valor p (unilateral) = 0,060963
Valor p (2 lados) = 0,121926
//set summary table to hidden to start var summary_display = document.getElementById("summary_table"); summary_display.style.display = "none";
//find which radio button is checked function check() { if (document.getElementById('raw').checked) { var table_display = document.getElementById("words_table"); table_display.style.display = "block"; var summary_display = document.getElementById("summary_table"); summary_display.style.display = "none"; } else { var table_display = document.getElementById("words_table"); table_display.style.display = "none"; var summary_display = document.getElementById("summary_table"); summary_display.style.display = "block"; }
} //end check
//perform one-sample t-test function calc() { if (document.getElementById('summary').checked) { 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 df = n1-(-1*n2)-2; var sp = Math.sqrt(((n1-1)*Math.pow(s1,2) - (-1*((n2-1)*Math.pow(s2,2))))/df); var t = (x1-x2)/(sp*Math.sqrt(1/n1 - (-1/n2))); if (t<0) { var p1 = jStat.studentt.cdf(t, df); var p2 = p1*2; } else { var p1 = 1-jStat.studentt.cdf(t, df); var p2 = p1*2; } document.getElementById('t').innerHTML = t.toFixed(6); document.getElementById('df').innerHTML = df; document.getElementById('p1').innerHTML = p1.toFixed(6); document.getElementById('p2').innerHTML = p2.toFixed(6); } else { var raw1 = document.getElementById('rawData1').value.split(',').map(Number); var raw2 = document.getElementById('rawData2').value.split(',').map(Number); var x1 = math.mean(raw1) var s1 = math.std(raw1) var n1 = raw1.length; var x2 = math.mean(raw2) var s2 = math.std(raw2) var n2 = raw2.length; var df = n1-(-1*n2)-2; var sp = Math.sqrt(((n1-1)*Math.pow(s1,2) - (-1*((n2-1)*Math.pow(s2,2))))/df); var t = (x1-x2)/(sp*Math.sqrt(1/n1 - (-1/n2))); if (t<0) { var p1 = jStat.studentt.cdf(t, df); var p2 = p1*2; } else { var p1 = 1-jStat.studentt.cdf(t, df); var p2 = p1*2; } document.getElementById('t').innerHTML = t.toFixed(6); document.getElementById('df').innerHTML = df; document.getElementById('p1').innerHTML = p1.toFixed(6); document.getElementById('p2').innerHTML = p2.toFixed(6); } //output results }