Wilcoxon ondertekende plaatstestcalculator
Voorbeeld 1
Voorbeeld 2
Teststatistiek W = 29,5
Aantal niet-ex aequo-paren (n) = 13
Raadpleeg de onderstaande tabel met kritische waarden om te beslissen of het testresultaat al dan niet statistisch significant is op basis van n en het gekozen alfaniveau.
Als de teststatistiek W kleiner is dan de waarde in de onderstaande tabel met kritische waarden, is het testresultaat statistisch significant.
function calc() { //get raw data var raw1 = document.getElementById('rawData1').value.split(',').map(Number); var raw2 = document.getElementById('rawData2').value.split(',').map(Number);
//calculate raw paired differences var diff = []; for (var i = 0; i < raw1.length; i++) { if (raw1[i]-raw2[i] != 0) { diff.push(raw1[i]-raw2[i]); } } //calculate absolute paired differences var diff_abs = []; for (var i = 0; i < raw1.length; i++) { if (raw1[i]-raw2[i] != 0) { diff_abs.push(Math.abs(raw1[i]-raw2[i])); } } //rank absolute paired differences var sorted = diff_abs.slice().sort(function(a,b){return a-b}) var reversed = sorted.slice(0).reverse(); var frac_rank = diff_abs.slice().map(function(n) { return ( (sorted.indexOf(n) + 1) + (reversed.length - reversed.indexOf(n)) ) / 2 }); //create array of positive ranks var positive_ranks = []; for (var i = 0; i < diff.length; i++) { if (diff[i] > 0) { positive_ranks.push(frac_rank[i]); } }
//create array of negative ranks var negative_ranks = []; for (var i = 0; i < diff.length; i++) { if (diff[i] < 0) { negative_ranks.push(frac_rank[i]); } } //find sum of positive and negative ranks var positive_sum = Math.abs(math.sum(positive_ranks)); var negative_sum = Math.abs(math.sum(negative_ranks)); var w = Math.min(positive_sum, negative_sum); var n = diff.length; //output results document.getElementById('w').innerHTML = w; document.getElementById('n').innerHTML = n; }