T 検定計算機の例
t = 0.3232
df = 39
p 値 (片側) = 0.1245
p 値 (両側) = 0.3232
//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 mu = +document.getElementById('mu').value; var x = +document.getElementById('x').value; var s = +document.getElementById('s').value; var n = +document.getElementById('n').value;
var t = (x-mu)/(s/Math.sqrt(n)); var df = n-1; 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 raw = document.getElementById('rawData').value.split(',').map(Number); var mu = +document.getElementById('mu').value; var x = math.mean(raw) var s = math.std(raw) var n = raw.length; var t = (x-mu)/(s/Math.sqrt(n)); var df = n-1; 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 }