tracts.util.sex_bias_to_optimizer_function#

sex_bias_to_optimizer_function(y)#

Convert a sex-bias parameter from physical space to optimizer space. This transformation maps values in the interval [-1, 1] to the real line using the log-ratio transformation:

\[\log(1 + y) - \log(1 - y).\]

Non-finite values (e.g., at the boundaries y = ±1) are replaced by ±1e32.

Parameters:

y (float | numpy.ndarray) – Sex-bias parameter in physical space.

Returns:

Sex-bias parameter in optimizer space.

Return type:

float | numpy.ndarray