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_hmuses 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_intandiabt_intbound the integral below bymax(0, xi - 10*tau)taken over allxi(andiarcsin_intandiahw_intabove bymin(pi/2 or 1, xi + 10*tau), also over allxi), so a vector call can differ from elementwise calls, and one NaN inximakes every value NaN;ztor_mode(NaN)and similar return a number, as R'soptimize()replaces non-finite values by the largest double.
Differences from R:
- with
tau2 = 0the*_modefunctions return the plain back-transform elementwise (in R a vectorxithen yields every valuelength(xi)times); targsis a mapping with metafor's list names (tau2,lower,upper,ni,sd) or, as in R, a scalar or a positional vector;ipft_hmalso accepts the sample sizes directly (R errors);- R's NA and NaN are both NaN.
rtoz ¶
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 |
ztor ¶
ztor_int ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
ztor_mode ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
r2toz ¶
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 |
ztor2 ¶
exp_int ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
exp_mode ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
logit ¶
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 |
ilogit ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
arcsin ¶
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 |
iarcsin ¶
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 |
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
probit ¶
iprobit ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
pft ¶
Freeman-Tukey double arcsine transformation of proportions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xi
|
ArrayLike
|
proportions ( |
required |
ni
|
ArrayLike
|
sample sizes, scalar or array-like. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) of the transformed proportions. |
ipft ¶
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 |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) of proportions. |
ipft_hm ¶
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 |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) of proportions with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
isqrt ¶
irft ¶
Freeman-Tukey transformation of incidence rates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xi
|
ArrayLike
|
incidence rates ( |
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. |
iirft ¶
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. |
ahw ¶
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 |
iahw ¶
iahw_int ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
iahw_mode ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
abt ¶
iabt ¶
iabt_int ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
iabt_mode ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
dtou1 ¶
dtou2 ¶
dtou3 ¶
dtoovl ¶
dtocles ¶
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 |
clestod ¶
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 |
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
dtocliffd ¶
dtobesd ¶
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 |
dtomd ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
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 |
None
|
n2i
|
ArrayLike | None
|
sizes of the second group, like |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
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 |
None
|
n2i
|
ArrayLike | None
|
sizes of the second group, like |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
rpbtorbis ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
a |
rtorpb ¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
a |
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 |
None
|
n2i
|
ArrayLike | None
|
sizes of the second group, like |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
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 |
None
|
n2i
|
ArrayLike | None
|
sizes of the second group, like |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
|
lnortord ¶
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 |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
a |
lnortorr ¶
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 |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Float array (at least 1-d) with the shape of |
Raises:
| Type | Description |
|---|---|
InputError
|
a |
lnortod_norm ¶
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 |
lnortod_logis ¶
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 |
dtolnor_norm ¶
dtolnor_logis ¶
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 |
lnortortet_pearson ¶
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 |
lnortortet_digby ¶
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 |
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 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 |