rheon.corr.to_z¶
- rheon.corr.to_z(rho: Any) Any[source]¶
Apply Fisher’s transform,
z = atanh(rho), to correlations elementwise.Use it to move correlations to a scale on which their sampling error is about normal, with variance
1 / (n - 3), before you average, difference or test them.from_z()maps back.Parameters
rhoA correlation, or an array of them.
|rho|is clipped atZ_CLIP,1 - 1e-6, so a degenerate±1gives a finitezof about 7.25, whereatanhwould giveinf.
Returns
A float, or a float array of
rho’s shape.Examples
print(rp.corr.to_z([0.0, 0.5, 1.0]).round(3))
[0. 0.549 7.254]
See also
from_z(), the inverse.fisher_se(), the standard error ofz.
Notes
Because of the clip, the round trip through
from_z()is not quite the identity at the ends: it gives back±Z_CLIP, to rounding, for±1.