(n)
| 135 | // Exact null distribution of the Wilcoxon signed-rank statistic for n pairs: |
| 136 | // cdf[k] is the probability that the positive-rank sum is at most k. |
| 137 | function signedRankCdf(n) { |
| 138 | let counts = [1]; |
| 139 | for (let rank = 1; rank <= n; rank++) { |
| 140 | let next = Array(counts.length + rank).fill(0); |
| 141 | counts.forEach((count, sum) => { |
| 142 | next[sum] += count; |
| 143 | next[sum + rank] += count; |
| 144 | }); |
| 145 | counts = next; |
| 146 | } |
| 147 | let cumulative = 0; |
| 148 | return counts.map(count => (cumulative += count) / 2 ** n); |
| 149 | } |
| 150 | |
| 151 | // Hodges–Lehmann estimate and distribution-free confidence interval for a paired |
| 152 | // shift, from the sorted Walsh averages of the per-block changes. The interval uses |
no outgoing calls
no test coverage detected