
Rescale a Probability-Scale Effect Size
trans_rank_prob.RdTransforms a probability-scale effect size (and, optionally, its standard
error, confidence interval, and null value) between four scales:
"probability", "difference", "logodds", and "odds".
This function serves as both a standalone utility and the internal engine
for brunner_munzel(scale = ...).
Arguments
- estimate
numeric; the point estimate to transform.
- se
numeric or
NULL; standard error ofestimate. Transformed via the delta method.- ci
numeric vector of length 2 or
NULL; confidence interval endpoints. Because every scale conversion is monotonic, CI endpoints are transformed directly (coverage is preserved without the delta method).- null
numeric (scalar or vector) or
NULL; the null-hypothesis value(s) to transform (e.g., a single null, or two equivalence bounds).- from
character; the scale
estimateis currently on. One of"probability","difference","logodds","odds".- to
character; the target scale. One of
"probability","difference","logodds","odds".
Value
A list with components:
- estimate
transformed point estimate
- se
transformed standard error (or
NULL)- ci
transformed CI endpoints (or
NULL)- null
transformed null value(s) (or
NULL)- from
the
fromscale (echoed back)- to
the
toscale (echoed back)
Details
The four scales and their relationship to a probability \(p\) are:
| Scale | Domain | Formula | Null at stochastic equality |
| probability | \((0, 1)\) | \(p\) | 0.5 |
| difference | \((-1, 1)\) | \(2p - 1\) | 0 |
| logodds | \((-\infty, \infty)\) | \(\log[p / (1-p)]\) | 0 |
| odds | \((0, \infty)\) | \(p / (1-p)\) | 1 |
All conversions are routed through the probability scale internally.
Standard errors are transformed via the delta method:
$$\mathrm{SE}_{\mathrm{target}} = \mathrm{SE}_{\mathrm{original}} \times \left|\frac{dp}{dx}\right| \times \left|\frac{dy}{dp}\right|$$
where \(x\) is the original scale and \(y\) is the target scale.
Confidence intervals are transformed by applying the monotonic mapping directly to each endpoint, which preserves coverage exactly.
At the boundaries (\(p = 0\) or \(p = 1\)), transformations to the logodds scale return \(\pm\infty\), and the delta-method SE is infinite. This is mathematically correct behaviour; no clamping or warning is applied.
See also
Other effect sizes:
boot_ses_calc(),
boot_smd_calc(),
rank_diff(),
ses_calc(),
smd_calc()
Examples
# Probability to difference (rank-biserial)
trans_rank_prob(0.7, se = 0.05, ci = c(0.6, 0.8),
null = 0.5, from = "probability", to = "difference")
#> $estimate
#> [1] 0.4
#>
#> $se
#> [1] 0.1
#>
#> $ci
#> [1] 0.2 0.6
#>
#> $null
#> [1] 0
#>
#> $from
#> [1] "probability"
#>
#> $to
#> [1] "difference"
#>
# Probability to odds
trans_rank_prob(0.7, from = "probability", to = "odds")
#> $estimate
#> [1] 2.333333
#>
#> $se
#> NULL
#>
#> $ci
#> NULL
#>
#> $null
#> NULL
#>
#> $from
#> [1] "probability"
#>
#> $to
#> [1] "odds"
#>
# Round-trip: logodds -> probability -> logodds
lo <- trans_rank_prob(0.8473, from = "logodds", to = "probability")
trans_rank_prob(lo$estimate, from = "probability", to = "logodds")
#> $estimate
#> [1] 0.8473
#>
#> $se
#> NULL
#>
#> $ci
#> NULL
#>
#> $null
#> NULL
#>
#> $from
#> [1] "probability"
#>
#> $to
#> [1] "logodds"
#>
# Apply to brunner_munzel output
res <- brunner_munzel(mpg ~ am, data = mtcars)
#> Sample size in at least one group is small. Permutation test (test_method = 'perm') is highly recommended.
trans_rank_prob(as.numeric(res$estimate),
se = res$stderr,
ci = as.numeric(res$conf.int),
null = as.numeric(res$null.value),
from = "probability", to = "logodds")
#> $estimate
#> [1] -1.58534
#>
#> $se
#> [1] 0.5481483
#>
#> $ci
#> [1] -4.6886990 -0.7038185
#>
#> $null
#> [1] 0
#>
#> $from
#> [1] "probability"
#>
#> $to
#> [1] "logodds"
#>