Skip to content

Transformations

Transformation functions, used as transf= or atransf= in predict, confint and the plot functions. metafor's transf.ilogit is metafopy.transf.ilogit, and transf.ipft.hm is metafopy.transf.ipft_hm. Each is also a top-level function with the mechanical translation of the R name, metafopy.transf_ilogit and metafopy.transf_ipft_hm. Functions with _int and _mode suffixes integrate over or find the mode of the distribution of the true effects, and take targs={'tau2': ...} (some also accept other targs keys, see each function).

Transformation functions (metafor's transf.*).

A port of R/transf.r from metafor 5.2-1. metafor's transf.rtoz is metafopy.transf.rtoz here, transf.ipft.hm is metafopy.transf.ipft_hm, and so on (the remaining . becomes _); the same functions are also metafopy.transf_rtoz, metafopy.transf_ipft_hm, ..., the mechanical translation of the R names. Argument names and defaults are metafor's. The functions are documented on metafor's help page, ?transf (https://wviechtb.github.io/metafor/reference/transf.html). Sources cited there:

  • Fisher (1921), r-to-z (Metron, 1, 1-32; the link on metafor's help page, https://hdl.handle.net/2440/15169, no longer resolves);
  • Freeman & Tukey (1950), double arcsine and incidence-rate transformations, doi:10.1214/aoms/1177729756, inverted as in Miller (1978), doi:10.1080/00031305.1978.10479283 (ipft_hm uses the harmonic mean of the sample sizes);
  • Hakstian & Whalen (1976), doi:10.1007/BF02291840, and Bonett (2002), doi:10.3102/10769986027004335, for coefficient alpha;
  • Olkin & Finn (1995), doi:10.1037/0033-2909.118.1.155, for R-squared;
  • Cohen (1988) U1-U3, Inman & Bradley (1989), doi:10.1080/03610928908830127, and Grice & Barrett (2014), doi:10.2466/03.pr0.115c29z4, for overlap; McGraw & Wong (1992), doi:10.1037/0033-2909.111.2.361, for the CLES; Rosenthal & Rubin (1982), doi:10.1037/0022-0663.74.2.166, for the BESD;
  • Jacobs & Viechtbauer (2017), doi:10.1002/jrsm.1218, for (point-)biserial correlations;
  • Cox & Snell (1989) and Chinn (2000), doi:10.1002/1097-0258(20001130)19:22<3127::aid-sim784>3.0.co;2-m, for log odds ratios to SMDs; Pearson (1900), doi:10.1098/rsta.1900.0022, and Digby (1983), doi:10.2307/2531104, for tetrachoric approximations.

Every function accepts array-likes or scalars (NaN or None for R's NA) and returns a float ndarray that is at least 1-d (R has no scalars), with the broadcast shape of the inputs.

The *_int functions integrate with SciPy's QUADPACK qags/qagi, the routines behind R's integrate(), using R's defaults (rel.tol = abs.tol = .Machine$double.eps^0.25, 100 subdivisions); where R's integrate() stops with an error, metafor returns NA and so do these. ilogit_mode uses the line-for-line port of R's uniroot(), exp_mode is a closed form and the other *_mode functions use the port of R's optimize(). exp_int is the closed form exp(xi + tau2/2).

Behaviour kept from R, including its quirks:

  • iarcsin_int, iahw_int and iabt_int bound the integral below by max(0, xi - 10*tau) taken over all xi (and iarcsin_int and iahw_int above by min(pi/2 or 1, xi + 10*tau), also over all xi), so a vector call can differ from elementwise calls, and one NaN in xi makes every value NaN;
  • ztor_mode(NaN) and similar return a number, as R's optimize() replaces non-finite values by the largest double.

Differences from R:

  • with tau2 = 0 the *_mode functions return the plain back-transform elementwise (in R a vector xi then yields every value length(xi) times);
  • targs is a mapping with metafor's list names (tau2, lower, upper, ni, sd) or, as in R, a scalar or a positional vector; ipft_hm also accepts the sample sizes directly (R errors);
  • R's NA and NaN are both NaN.

rtoz

rtoz(xi: ArrayLike) -> NDArray[float64]

Fisher's r-to-z transformation of correlation coefficients, atanh(xi); xi is truncated to [-1, 1] first.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

ztor

ztor(xi: ArrayLike) -> NDArray[float64]

Inverse of the r-to-z transformation, tanh(xi).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

ztor_int

ztor_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for z-to-r: the mean of tanh(Z) for Z ~ N(xi, tau2), the back-transformed average correlation.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; default: 10 standard deviations around each value). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

ztor_mode

ztor_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of the distribution of the correlations when the z-transformed values are N(xi, tau2), found numerically.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

r2toz

r2toz(xi: ArrayLike) -> NDArray[float64]

Variance-stabilizing transformation for R-squared values, atanh(sqrt(xi)); xi is truncated to [0, 1] first.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

ztor2

ztor2(xi: ArrayLike) -> NDArray[float64]

Inverse of r2toz, tanh(xi)^2.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

exp_int

exp_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for the exponential: the mean of a log-normal variable, exp(xi + tau2/2).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper); lower and upper are accepted but not used, because the closed form needs no integration. For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

exp_mode

exp_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of a log-normal variable, exp(xi - tau2).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

logit

logit(xi: ArrayLike) -> NDArray[float64]

Logit transformation of proportions, qlogis(xi); NaN outside [0, 1].

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

ilogit

ilogit(xi: ArrayLike) -> NDArray[float64]

Inverse logit transformation, plogis(xi).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

ilogit_int

ilogit_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for the inverse logit: the mean of a logit-normal variable, the back-transformed average proportion.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; default: 10 standard deviations around each value). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

ilogit_mode

ilogit_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of a logit-normal variable. NaN where the density is bimodal (as in metafor).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

arcsin

arcsin(xi: ArrayLike) -> NDArray[float64]

Arcsine square root transformation of proportions, asin(sqrt(xi)); NaN outside [0, 1].

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iarcsin

iarcsin(xi: ArrayLike) -> NDArray[float64]

Inverse arcsine square root transformation, sin(xi)^2; 0 for xi < 0 and 1 for xi > pi/2.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iarcsin_int

iarcsin_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for the inverse arcsine: the mean of sin(Z)^2 for Z ~ N(xi, tau2) truncated to [0, pi/2].

As in metafor, the default bounds are max(0, xi - 10*tau) and min(pi/2, xi + 10*tau) taken over all values of xi, so a vector call can differ from elementwise calls.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; defaults as described above). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

iarcsin_mode

iarcsin_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of the proportions when the arcsine square root transformed values are N(xi, tau2) truncated to [0, pi/2].

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

probit

probit(xi: ArrayLike) -> NDArray[float64]

Probit transformation of proportions, qnorm(xi).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iprobit

iprobit(xi: ArrayLike) -> NDArray[float64]

Inverse probit transformation, pnorm(xi).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iprobit_int

iprobit_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for the inverse probit: the mean of pnorm(Z) for Z ~ N(xi, tau2).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; default: 10 standard deviations around each value). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

iprobit_mode

iprobit_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of the proportions when the probit transformed values are N(xi, tau2).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

pft

pft(xi: ArrayLike, ni: ArrayLike) -> NDArray[float64]

Freeman-Tukey double arcsine transformation of proportions.

Parameters:

Name Type Description Default
xi ArrayLike

proportions (x / n), scalar or array-like.

required
ni ArrayLike

sample sizes, scalar or array-like. xi and ni are recycled to the longer length, with a warning if it is not a multiple.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of the transformed proportions.

Metafor reference

transf

ipft

ipft(xi: ArrayLike, ni: ArrayLike) -> NDArray[float64]

Inverse of the Freeman-Tukey double arcsine transformation (Miller, 1978); 0 and 1 outside the attainable range.

Parameters:

Name Type Description Default
xi ArrayLike

transformed values, scalar or array-like.

required
ni ArrayLike

sample sizes, scalar or array-like, recycled with xi to the longer length.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of proportions.

Metafor reference

transf

ipft_hm

ipft_hm(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None,
) -> NDArray[float64]

Inverse Freeman-Tukey double arcsine transformation using the harmonic mean of the sample sizes (Miller, 1978).

Parameters:

Name Type Description Default
xi ArrayLike

transformed values, scalar or array-like.

required
targs ArrayLike | Mapping[str, Any] | None

mapping with ni, the sample sizes whose harmonic mean (ignoring missing values) is used. Unlike R, the sample sizes can also be given directly as a sequence.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of proportions with the shape of xi.

Raises:

Type Description
InputError

targs is missing or has no ni.

Metafor reference

transf

isqrt

isqrt(xi: ArrayLike) -> NDArray[float64]

Inverse of the square root transformation, xi^2; 0 for xi < 0.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

irft

irft(xi: ArrayLike, ti: ArrayLike) -> NDArray[float64]

Freeman-Tukey transformation of incidence rates.

Parameters:

Name Type Description Default
xi ArrayLike

incidence rates (x / t), scalar or array-like.

required
ti ArrayLike

person-times, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of the transformed rates.

Metafor reference

transf

iirft

iirft(xi: ArrayLike, ti: ArrayLike) -> NDArray[float64]

Inverse of irft; 0 below the attainable range.

Parameters:

Name Type Description Default
xi ArrayLike

transformed values, scalar or array-like.

required
ti ArrayLike

person-times, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of incidence rates.

Metafor reference

transf

ahw

ahw(xi: ArrayLike) -> NDArray[float64]

Hakstian and Whalen transformation of coefficient alpha, 1 - (1 - xi)^(1/3); NaN for xi > 1.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iahw

iahw(xi: ArrayLike) -> NDArray[float64]

Inverse of ahw, 1 - (1 - xi)^3, truncated to [0, 1].

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iahw_int

iahw_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for the inverse Hakstian-Whalen transformation, with the normal distribution truncated to [0, 1].

As in metafor, the default bounds are taken over all values of xi, so a vector call can differ from elementwise calls.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; defaults as described above). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

iahw_mode

iahw_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of the alpha values when the Hakstian-Whalen transformed values are N(xi, tau2) truncated to [0, 1].

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

abt

abt(xi: ArrayLike) -> NDArray[float64]

Bonett transformation of coefficient alpha, -log(1 - xi).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iabt

iabt(xi: ArrayLike) -> NDArray[float64]

Inverse of abt, 1 - exp(-xi); 0 for xi < 0.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

iabt_int

iabt_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for the inverse Bonett transformation, with the normal distribution truncated to [0, Inf).

As in metafor, the default lower bound is taken over all values of xi, so a vector call can differ from elementwise calls.

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; defaults as described above). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

iabt_mode

iabt_mode(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Mode of the alpha values when the Bonett transformed values are N(xi, tau2) truncated to [0, Inf).

Parameters:

Name Type Description Default
xi ArrayLike

values to transform, scalar or array-like (NaN or None for a missing value).

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects), or just the scalar tau2. A tau2 below machine epsilon is treated as 0, when the plain back-transformation is returned.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, or tau2 is negative or not a scalar.

Metafor reference

transf

dtou1

dtou1(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to Cohen's U1 (the proportion of non-overlap).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtou2

dtou2(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to Cohen's U2, pnorm(xi/2).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtou3

dtou3(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to Cohen's U3, pnorm(xi).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtoovl

dtoovl(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to the overlapping coefficient, 2*pnorm(-|xi|/2).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtocles

dtocles(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to the common language effect size (probability of superiority), pnorm(xi/sqrt(2)).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

clestod

clestod(xi: ArrayLike) -> NDArray[float64]

Inverse of dtocles: common language effect size to standardized mean difference, qnorm(xi)*sqrt(2).

Parameters:

Name Type Description Default
xi ArrayLike

common language effect sizes (probabilities), scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtocles_int

dtocles_int(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Integral transformation for dtocles: the mean of pnorm(Z/sqrt(2)) for Z ~ N(xi, tau2).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required
targs ArrayLike | Mapping[str, Any] | None

mapping with tau2 (required, >= 0: the variance of the distribution of the true effects) and optionally lower and upper (bounds of the integration; default: 10 standard deviations around each value). Also accepted, as in R: a scalar or a positional sequence (tau2, lower, upper). For example predict and confint fill in tau2 of the model when targs is None.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no tau2, has more than three elements, or tau2 is negative or not a scalar.

Metafor reference

transf

dtocliffd

dtocliffd(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to Cliff's delta, 2*pnorm(xi/sqrt(2)) - 1.

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtobesd

dtobesd(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to the binomial effect size display (the proportion above the median in the first group).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtomd

dtomd(
    xi: ArrayLike,
    targs: ArrayLike | Mapping[str, Any] | None = None,
) -> NDArray[float64]

Standardized mean difference to mean difference for a known standard deviation, xi * sd.

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required
targs ArrayLike | Mapping[str, Any] | None

mapping with sd, the standard deviation (a single value), or just the scalar sd.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

targs is missing, has no sd, or sd is not a single value.

Metafor reference

transf

dtorpb

dtorpb(
    xi: ArrayLike,
    n1i: ArrayLike | None = None,
    n2i: ArrayLike | None = None,
) -> NDArray[float64]

Standardized mean difference to point-biserial correlation.

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required
n1i ArrayLike | None

sizes of the first group, scalar or array-like, one per value of xi. Default None: equal group sizes are assumed.

None
n2i ArrayLike | None

sizes of the second group, like n1i. Both n1i and n2i are needed to use the group sizes.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

n1i and n2i differ in length or do not match the length of xi.

Metafor reference

transf

dtorbis

dtorbis(
    xi: ArrayLike,
    n1i: ArrayLike | None = None,
    n2i: ArrayLike | None = None,
) -> NDArray[float64]

Standardized mean difference to biserial correlation (via the point-biserial correlation).

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required
n1i ArrayLike | None

sizes of the first group, scalar or array-like, one per value of xi. Default None: equal group sizes are assumed.

None
n2i ArrayLike | None

sizes of the second group, like n1i. Both n1i and n2i are needed to use the group sizes.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

n1i and n2i differ in length or do not match the length of xi.

Metafor reference

transf

rpbtorbis

rpbtorbis(
    xi: ArrayLike, pi: ArrayLike | None = None
) -> NDArray[float64]

Point-biserial correlation to biserial correlation.

Parameters:

Name Type Description Default
xi ArrayLike

point-biserial correlations, scalar or array-like.

required
pi ArrayLike | None

proportion of cases in the first group, a single value or one per value of xi, in [0, 1]. Default None: 0.5.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

a pi value is outside [0, 1] or its length does not match xi.

Metafor reference

transf

rtorpb

rtorpb(
    xi: ArrayLike, pi: ArrayLike | None = None
) -> NDArray[float64]

Pearson correlation to point-biserial correlation after dichotomizing one variable.

Parameters:

Name Type Description Default
xi ArrayLike

Pearson correlations, scalar or array-like.

required
pi ArrayLike | None

proportion of cases in the first group after dichotomizing, a single value or one per value of xi, in [0, 1]. Default None: 0.5.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

a pi value is outside [0, 1] or its length does not match xi.

Metafor reference

transf

rtod

rtod(
    xi: ArrayLike,
    n1i: ArrayLike | None = None,
    n2i: ArrayLike | None = None,
) -> NDArray[float64]

Pearson correlation (with one dichotomized variable) to standardized mean difference; inverse of dtorbis.

Parameters:

Name Type Description Default
xi ArrayLike

Pearson correlations, scalar or array-like.

required
n1i ArrayLike | None

sizes of the first group, scalar or array-like, one per value of xi. Default None: equal group sizes are assumed.

None
n2i ArrayLike | None

sizes of the second group, like n1i. Both n1i and n2i are needed to use the group sizes.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

n1i and n2i differ in length, do not match xi, or are negative.

Metafor reference

transf

rpbtod

rpbtod(
    xi: ArrayLike,
    n1i: ArrayLike | None = None,
    n2i: ArrayLike | None = None,
) -> NDArray[float64]

Point-biserial correlation to standardized mean difference; inverse of dtorpb.

Parameters:

Name Type Description Default
xi ArrayLike

point-biserial correlations, scalar or array-like.

required
n1i ArrayLike | None

sizes of the first group, scalar or array-like, one per value of xi. Default None: equal group sizes are assumed.

None
n2i ArrayLike | None

sizes of the second group, like n1i. Both n1i and n2i are needed to use the group sizes.

None

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

n1i and n2i differ in length or do not match the length of xi.

Metafor reference

transf

lnortord

lnortord(xi: ArrayLike, pc: ArrayLike) -> NDArray[float64]

Log odds ratio to risk difference for a given control group risk.

Parameters:

Name Type Description Default
xi ArrayLike

log odds ratios, scalar or array-like.

required
pc ArrayLike

control group risk, a single value or one per value of xi, in [0, 1].

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

a pc value is outside [0, 1] or its length does not match xi.

Metafor reference

transf

lnortorr

lnortorr(xi: ArrayLike, pc: ArrayLike) -> NDArray[float64]

Log odds ratio to risk ratio (not the log risk ratio) for a given control group risk.

Parameters:

Name Type Description Default
xi ArrayLike

log odds ratios, scalar or array-like.

required
pc ArrayLike

control group risk, a single value or one per value of xi, in [0, 1].

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Raises:

Type Description
InputError

a pc value is outside [0, 1] or its length does not match xi.

Metafor reference

transf

lnortod_norm

lnortod_norm(xi: ArrayLike) -> NDArray[float64]

Log odds ratio to standardized mean difference assuming normal distributions (Cox and Snell, 1989), xi/1.65.

Parameters:

Name Type Description Default
xi ArrayLike

log odds ratios, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

lnortod_logis

lnortod_logis(xi: ArrayLike) -> NDArray[float64]

Log odds ratio to standardized mean difference assuming logistic distributions (Chinn, 2000), sqrt(3)/pi*xi.

Parameters:

Name Type Description Default
xi ArrayLike

log odds ratios, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtolnor_norm

dtolnor_norm(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to log odds ratio assuming normal distributions, xi*1.65.

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

dtolnor_logis

dtolnor_logis(xi: ArrayLike) -> NDArray[float64]

Standardized mean difference to log odds ratio assuming logistic distributions, xi/sqrt(3)*pi.

Parameters:

Name Type Description Default
xi ArrayLike

standardized mean differences, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

lnortortet_pearson

lnortortet_pearson(xi: ArrayLike) -> NDArray[float64]

Log odds ratio to tetrachoric correlation, using the approximation of Pearson (1900), cos(pi/(1 + sqrt(exp(xi)))).

Parameters:

Name Type Description Default
xi ArrayLike

log odds ratios, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

lnortortet_digby

lnortortet_digby(xi: ArrayLike) -> NDArray[float64]

Log odds ratio to tetrachoric correlation, using the approximation of Digby (1983), (OR^(3/4) - 1)/(OR^(3/4) + 1).

Parameters:

Name Type Description Default
xi ArrayLike

log odds ratios, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) with the shape of xi.

Metafor reference

transf

R's distribution functions

plogis, qlogis, pnorm and qnorm are R's, kept in metafopy.transf because metafor code passes them as transf=.

R's plogis(): the standard logistic distribution function, 1/(1 + exp(-x)).

Parameters:

Name Type Description Default
x ArrayLike

quantiles, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of probabilities with the shape of x.

R's qlogis(): the standard logistic quantile function (logit), log(p/(1 - p)); NaN outside [0, 1].

Parameters:

Name Type Description Default
p ArrayLike

probabilities, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of quantiles with the shape of p.

R's pnorm(): the standard normal distribution function.

Parameters:

Name Type Description Default
x ArrayLike

quantiles, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of probabilities with the shape of x.

R's qnorm(): the standard normal quantile function.

Parameters:

Name Type Description Default
p ArrayLike

probabilities, scalar or array-like.

required

Returns:

Type Description
NDArray[float64]

Float array (at least 1-d) of quantiles with the shape of p.