You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rank_biserial(paired = TRUE): the confidence interval counts x != mu instead of the nonzero paired differences #716
For paired samples, rank_biserial() computes the estimate from the paired differences (x - y) - mu, but the standard error of its confidence interval takes the number of observations from x alone:
nd<- sum((x-mu) !=0)
(R/rank_diff.R, line 179 on main; the same in 1.0.3 on CRAN). In the paired case x and y are still separate vectors at that point, so nd counts the values of x that differ from mu, not the nonzero differences that the estimate is built on. Whenever the two counts differ, the interval is too narrow or too wide. The one-sample case is not affected, since y is 0 there.
To Reproduce
x holds no zeros, but three of the ten differences are zero:
The two calls describe the same data and give the same estimate, 0.642857, but the paired call uses nd = 10 where there are 7 nonzero differences, and its interval excludes zero while the correct one does not.
Expected behavior
The paired call should give the same interval as the one-sample call on the differences, [-0.065116, 0.920343], which is what nd = 7 gives. A possible fix is to count the differences, as .r_rbs() does:
nd<- sum(((x-y) -mu) !=0)
This is separate from #502, which is about how zero differences enter the estimate itself.
Activity
mattansb commentedon Nov 1, 2026
Thanks @pr0m1th3as - should be fixed in #718