曼惠特尼 u 检验计算器
当样本分布不呈正态分布且样本量较小 (n < 30) 时,Mann-Whitney U 检验用于比较两个独立样本之间的差异。它被认为是独立双样本 t 检验的非参数等效项。
要对两个独立样本执行曼-惠特尼 U 检验,只需输入下面的数据值并单击“计算”按钮即可。
//create function that performs t test calculations function calc() {
var x = document.getElementById('x').value.match(/\d+/g).map(Number); var y = document.getElementById('y').value.match(/\d+/g).map(Number);
//calculate critical value U and p-value using script from https://gist.githubusercontent.com/gungorbudak/1c3989cc26b9567c6e50/raw/f8f2918a366798793f5fb7e92de0df9142feb737/mannwhitneyu.js var t = mannwhitneyu.test(x, y, alternative = 'two-sided');
var critical_value_U = t[Object.keys(t)[0]]; var p_value_one_tail = (t[Object.keys(t)[1]]) / 2; var p_value_two_tail = t[Object.keys(t)[1]];
//--------------OUTPUT RESULTS-----------// document.getElementById('U').innerHTML = "Test statistic U: " + critical_value_U.toFixed(1); document.getElementById('p_value_one_tail').innerHTML = "One-tailed P value: " + p_value_one_tail.toFixed(5); document.getElementById('p_value_two_tail').innerHTML = "Two-tailed P value: " + p_value_two_tail.toFixed(5); }